[Bug c++/57820] Can't initialize a constexpr object with inline initialization
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Jul 4 09:57:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57820
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-07-04
Ever confirmed|0 |1
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I think it's invalid unless you provide an initializer or the class has a
default constructor e.g.
constexpr C d = {};
G++ still rejects that though, with a very unhelpful diagnostic:
t.cc:8:18: error: ‘constexpr C::C()’ called in a constant expression
constexpr C d = {}; //error
^
t.cc:1:8: note: ‘constexpr C::C()’ is not usable as a constexpr function
because:
struct C
^
More information about the Gcc-bugs
mailing list