------- Comment #5 from rguenth at gcc dot gnu dot org 2007-11-29 11:00 ------- Yes, this looks invalid - but can we diagnose this at compile-time?
Also, from decl2.c: /* Error on namespace { struct A { static int i; }; } int foo () { return A::i; } without A::i definition (which can't be defined in a different CU because of the anonymous namespace). Don't do this if DECL_INITIAL is set, because for namespace { struct A { static const int i = 4; } }; decl_needed_p won't reliably detect whether it was really needed. */ if (DECL_IN_AGGR_P (decl) && DECL_INITIAL (decl) == NULL_TREE) error ("%Jstatic data member %qD used, but not defined", decl, decl); it suggests that we do not want to error in this case. But for some reason we do not have DECL_INITIAL set for a, but only in its template_decl->DECL_TEMPLATE_RESULT we can find it. -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rguenth at gcc dot gnu dot | |org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34238