I have a template template inside another class template. The inner class has a static data member. I'm struggling to give a definition. The following example works in clang 3.8, but not in gcc-7.1
template <typename T>
struct Out {
template <typename U>
struct In {
static int var;
};
};
template <typename T>
template <typename U>
int Out<T>::template In<U>::var;
gcc gives an error:
error: template definition of non-template ‘int Out<T>::In<U>::var’
int Out<T>::template In<U>::var;
^~~
What should I do to make gcc happy?
Edit: I get rid of template
doing this work:
template <typename T>
template <typename U>
int Out<T>::In<U>::var;
Which still leaves the question, is it allowed here template
?
source
share