Closed
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.