Open
Description
Consider: https://compiler-explorer.com/z/eqb4oqWqP
template<class T> class A;
template<class T>
typename A<T>::Z A<T>::X = 0; // #1
template<class T>
typename A<T>::Z A<T>::X::Y = 0; // #2
We recognize that #1
is an out-of-line definition attempt, and produce a sensible diagnostic that A has no definition.
Now add one more component to the nested name specifier, as in #2
, and now clang tries a name lookup into A<T>
, and complains it can't find X
, even though there is no definition at all.
This is otherwise a valid out of line definition for an example like: https://compiler-explorer.com/z/Wh84qvaY4
template<class T> class A {
class X {
static int Y;
};
using Z = int;
};
template<class T>
typename A<T>::Z A<T>::X::Y = 0;