c++ - Double template<> in template specialization -
why code below compile? not specializing template member function of template class, 1 template<>
should used. however, g++ compiles no warnings whatsoever, clang++ gives warning
warning: extraneous template parameter list in template specialization
template<typename t> struct s{}; template<> template<> // why can this? struct s<int>{}; int main() { }
because grammar allows it, , there doesn't seem under template specialization section prohibits it:
from [gram.temp]
explicit-specialization:
template < >
declaration
from [gram.dcl]
declaration:
[...]
explicit-specialization
the fact grammar lax has been in active issues list (#293) since 2001.
Comments
Post a Comment