Issue 142087
Summary [clang] error recovery not recognizing out-of-line definition
Labels clang:diagnostics
Assignees
Reporter mizvekov
    Consider: https://compiler-explorer.com/z/eqb4oqWqP
```C++
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<T> 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
```C++
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;
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to