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

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-11-10 18:10:28 UTC ---
Unfortunately the current standard says that your example is ill-formed. The
reason is based on the fact that member functions (including static ones) are
not parsed before the complete class definition has been seen. Due to this we
have 5.19 p2 b3:

"an invocation of an undefined constexpr function or an undefined constexpr
constructor outside the definition of a constexpr function or a constexpr
constructor"

combined with 9.2 p2:

"A class is considered a completely-defined object type (3.9) (or complete
type) at the closing } of the class-specifier. Within the class
member-specification, the class is regarded as complete within function bodies,
default arguments, exception-specifications, and brace-or-equal-initializers
for non-static data members (including such things in nested classes).
Otherwise it is regarded as incomplete within its own class
member-specification."

which makes the expression static_size() within the member data definition a
non-constant expression. I don't like this rule, but it is currently reality.

Reply via email to