[class.pre] p3 states:
If a class-head-name contains a nested-name-specifier, the class-specifier shall not inhabit a class scope. If its class-name is an identifier, the class-specifier shall correspond to one or more declarations nominable in the class, class template, or namespace to which the nested-name-specifier refers; they shall all have the same target scope, and the target scope of the class-specifier is that scope.
[ Example:
namespace N { template<class> struct A { struct B; }; } using N::A; template<class T> struct A<T>::B {}; // OK template<> struct A<void> {}; // OK
-- end example ]
The first sentence and the example seem to differ.
Is the specialization of A<void>
template, which does not contain a nested-name-specifier (but only 'relies' on using) still conformant?
clang and msvc accept it, gcc shows the error
error: explicit specialization of 'template struct N::A' outside its namespace must use a nested-name-specifier [-fpermissive]
Additional Context
The paper, which introduced the original wording and example comment, is P1787R6: Declarations and where to find them, containing the line:
template<> struct A<void> {}; // error: A not nominable in ::
An editorial change Edit: [class.pre] Fix incorrect comment in example changed the example so that the comment now says OK
. More discussion relating to it is found in editorial issue 4592