[Bug c++/86581] constexpr variable is not checked
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Jul 19 12:01:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86581
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2018-07-19
Ever confirmed|0 |1
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Reduced:
struct V {
union { int n; struct { int x,y; }; };
constexpr V() : x(0) {}
};
constexpr V v;
Clang says:
un.cc:4:12: error: constexpr constructor must initialize all members
constexpr V() : x(0) {}
^
un.cc:2:37: note: member not initialized by constructor
union { int n; struct { int x; int y; }; };
^
un.cc:6:13: error: no matching constructor for initialization of 'const V'
constexpr V v;
^
un.cc:1:8: note: candidate constructor (the implicit copy constructor) not
viable: requires 1 argument, but 0 were provided
struct V {
^
un.cc:1:8: note: candidate constructor (the implicit move constructor) not
viable: requires 1 argument, but 0 were provided
2 errors generated.
More information about the Gcc-bugs
mailing list