-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Full name of submitter (unless configured in github; will be published with the issue): Krystian Stasiowski
Reference (section label): [dcl.type.elab]
Link to reflector thread (if any): N/A
Issue description:
[dcl.type.elab] p2 states:
If an elaborated-type-specifier is the sole constituent of a declaration, the declaration is ill-formed unless it is an explicit specialization, an explicit instantiation or it has one of the following forms:
class-key attribute-specifier-seq(opt) identifier ; class-key attribute-specifier-seq(opt) simple-template-id ;
In the first case, the elaborated-type-specifier declares the identifier as a class-name. The second case shall appear only in an explicit-specialization or in a template-declaration (where it declares a partial specialization}.
Consider the following:
namespace N
{
template<typename T>
struct A;
}
template<>
struct N::A<int>; // #1
template<typename T>
struct N::A<T*>; // #2
The current wording permits the elaborated-type-specifier of #1
to contain a nested-name-specifier. However, #2
is ill-formed because it:
- declares neither an explicit specialization nor an explicit instantiation, and
- does not match the two explicitly permitted forms since it contains a nested-name-specifier.
Clang, GCC, EDG, and MSVC all accept the declaration of #2
. Presumably, this is an oversight in the wording.
Suggested resolution:
Modify [dcl.type.elab] p2 as follows:
If an elaborated-type-specifier is the sole constituent of a declaration, the declaration is ill-formed unless it is an explicit specialization, a partial specialization, an explicit instantiation or it has one of the following forms [...]