Skip to content

Access checks and copy elision before c++17Β #161858

@cor3ntin

Description

@cor3ntin

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

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions