http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51604

Daniel Krügler <daniel.kruegler at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler at
                   |                            |googlemail dot com

--- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> 
2011-12-17 23:49:07 UTC ---
This looks like an invalid issue to me. According to [class.static.data] p3:

"[..] A static data member of literal type can be declared in the
class definition with the constexpr specifier; if so, its declaration shall
specify a brace-or-equal-initializer in which every initializer-clause that is
an assignment-expression is a constant expression. [ Note: In both
these cases, the member may appear in constant expressions. —end note ] The
member shall still be defined in a namespace scope if it is odr-used (3.2) in
the program and the namespace scope definition shall not contain an
initializer."

which means the program should be rejected. The 4.7 head also rejects the code
as required by the standard.

Rewriting the code it to:

template <typename T>
class X {
  static constexpr unsigned char hello[] = {0, 1};
};

should solve the problem.

Reply via email to