-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Closed
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillac++clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerclang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"constexprAnything related to constant evaluationAnything related to constant evaluation
Description
Bugzilla Link | 38143 |
Version | trunk |
OS | All |
CC | @DougGregor,@marehr,@zygoloid |
Extended Description
Consider this code:
class span {
public:
using pointer = const int *;
constexpr span() : __data{nullptr} {}
constexpr span (const span&) noexcept = default;
constexpr span& operator=(const span&) noexcept = default;
~span() noexcept = default;
constexpr pointer data() const noexcept { return __data; }
private:
pointer __data;
};
When compiled with a recent clang [clang version 7.0.0 (trunk 336548)], (-std=c++2a
) it gives an error:
junk.cpp:8:5: error: defaulted definition of copy assignment operator is not
constexpr
constexpr span& operator=(const span&) noexcept = default;
^
However, if I switch the order of the two lines to:
~span() noexcept = default;
constexpr span& operator=(const span&) noexcept = default;
then it compiles w/o error.
However, I believe that it should compile w/o error in both cases.
Metadata
Metadata
Assignees
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillac++clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerclang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"constexprAnything related to constant evaluationAnything related to constant evaluation