I have a template class that has two private static members. Users define the characteristic structure and provide it to the template class, which then follows from it.
Then, in the C ++ file, the user defines static members, with one member being initialized from another. For some reason, I get a "class was not declared" error if I do not fully define the namespace for arg. This is only a problem when I'm in a nested namespace, there is no problem if you define a type in one top-level namespace, which makes me think that this is a compiler error. Below is an example below compiling with gcc 7.2
template<typename Traits> struct Base { static int x; static int y; }; namespace foo::bar { struct BarTraits { }; using Bar = Base<BarTraits>; template<> int Bar::x = 0; template<> int Bar::y( Bar::x );
source share