https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39970
Arthur O'Dwyer <arthur.j.odwyer at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |arthur.j.odwyer at gmail dot com --- Comment #9 from Arthur O'Dwyer <arthur.j.odwyer at gmail dot com> --- As of C++11, the original code is legitimate-ish: struct blah { int member; }; constexpr blah global = {42}; template <int param=global.member> class template_blah { }; template_blah<> x; // OK, param is 42 But: (1) GCC still incorrectly accepts the template even when `global` is non-const. So does MSVC. Clang correctly(?) rejects it. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96213 might be related. (2) I don't understand Brandon's original concern around mangling operator dot. The value of the default argument here is just "42"; we don't have to mangle the dot at all. An example of name-mangling the dot operator would be like template<class T> decltype(T().x) foo() { return 0; } struct S { int x; }; template int foo<S>(); which GCC correctly mangles as `_Z3fooI1SEDtdtcvT__E1xEv`. So I think the only remaining issue here is the incorrect acceptance of a non-const default argument for `int param`, and that part MIGHT duplicate bug #96213 which I just filed.