Access checks and copy elision before c++17
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
We claim to support guaranteed copy elision in C++03, but we still perform access checks for copy constructors (before c++17)
https://godbolt.org/z/WPEh8e94c
```cpp
class S {
public:
S(int, int);
// private:
S(const S &);
};
S s = S(0, 0);
```
If we make the constructor public, RVO is performed https://godbolt.org/z/WPEh8e94c
Aditionally `__cpp_guaranteed_copy_elision` is not set even if the documentation claim it should be
https://clang.llvm.org/docs/LanguageExtensions.html#id34
Maybe the documentation is just wrong.
Contributor guide
Research direction
Start with the reduced C++ example and the linked Godbolt results, comparing behavior before C++17 with and without an accessible copy constructor. Then inspect the Language Extensions documentation at the linked guaranteed-copy-elision section and the reported __cpp_guaranteed_copy_elision definition. Done means the access-check behavior and feature-test macro agree with the documented support, or the documentation is corrected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100