Issue 102927
Summary Clang rejects valid out of class definition of static data member of nested class template
Labels clang
Assignees
Reporter ranaanoop
    While answering [this question](https://stackoverflow.com/q/78862577/12002570) I noticed that clang rejects the following program while gcc and msvc correctly accept it. [Demo](https://godbolt.org/z/MbfK6zvrE)

```

#include <iostream>
template <class T>
class Outer
{
public:
  enum InnerType {foo, bar /* etc */};
  
  template <InnerType U>
  class Inner
  {
  public:
    static int x;
  };

public:
 
  void print() { std::cout << Inner<foo>::x << std::endl; }
};

template<class T> template<enum Outer<T>::InnerType I>  int Outer<T>::template Inner<I>::x =0;
int main()
{
    Outer<int> i;
    i.print();
}
```
Clang says:

```
<source>:21:90: error: nested name specifier 'Outer<T>::template template Inner<I>::' for declaration does not refer into a class, class template or class template partial specialization
   21 | template<class T> template<enum Outer<T>::InnerType I>  int Outer<T>::template Inner<I>::x =0;
      | 
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to