https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71534

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |msebor at gcc dot gnu.org

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
We have been interpreting the relevant text in temp.inst, p1 that:

"The implicit instantiation of a class template specialization causes the
implicit instantiation of the declarations, but not of the definitions, [...]
static data members [...]; and it causes the implicit instantiation of the
definitions of unscoped member enumerations and member anonymous unions."

to mean that the only the declaration but not the initializer of the static
const data member declared in a class is instantiated, and resolving other bug
reports like this one as invalid (for example, bug 58848 and bug 70820).

But the interpretation in the stackoverflow response that the initializer
expression for a static const data member initialized in the class is actually
part of the declaration does seem to be supported by the text in
class.static.data, p3 (quoted below) and by two other implementations I tried
(Clang 3.8 and EDG eccp 4.11):

"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. [...] 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."

I CC Jason for his opinion.

Reply via email to