template <class U> struct A { template<class T> void foo(); };
As you can see, the declaration is void foo(); , which is a valid function declaration. Thus, the first marker point is applied:
The declaration in the template declaration must
- declare or define a function, class, or variable, or
- define a member function, member class, element enumeration, or static data element of a class template or class nested in a class template or
Member functions are mentioned in the second pool only to emphasize that
template<class T> void A<T>::foo() {}
; The declaration in this template declaration ( void A<T>::foo() {} ) is the definition of a member function. "Or" is not exclusive, since the above declaration is still a function definition.
Now it becomes clear that this can only concern definitions, since
template<class T> void A<T>::foo();
not valid anyway.
source share