https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71569

--- Comment #6 from Oliver Tale-Yazdi <oliver.tale at web dot de> ---
It seems to be only dependent on the template specialization of the member.

–––––––––––––––––––––––––––––––––––––––––––––––––––
template <class T>
struct A {
  template <class U>
  static U u;
};

template <class T>
template <class U>
U A<T>::u = nullptr;
–––––––––––––––––––––––––––––––––––––––––––––––––––
template <class T>
struct A {
  template <class U>
  static U u;
};

template <class T>
template <class U>
U A<T>::u<U*> = nullptr;
–––––––––––––––––––––––––––––––––––––––––––––––––––

The first one is accepted, the second one ICE's. Both is valid C++14.


I also need to point out that >= 5.1 accepts weird (invalid?) Code, eg:

––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
#include <iostream>

template <class T>
struct A {
  template <class U>
  static U u;
};

template <class T>
template <class U>
U A<T>::u = nullptr;

int main()
{
    std::cerr << "'" << typeid(decltype(A<int>::u)).name() << "'" << std::endl;
}
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––

This dosent print _Anything_.
I dont even have to include <typeinfo>, which is needed, if I specialize u with
A<int>::u<int> in the second last line.
typeid seems to not be called.

Reply via email to