I think you could, grammatically, but it's forbidden by additional restrictions:
[temp]/1
A template defines a family of classes or functions or an alias for a family of types.
template-declaration:
template <
template-parameter-list>
declarationtemplate-parameter-list:
template-parameter
template-parameter-list,
template-parameter[...]
The declaration in a template-declaration shall
- declare or define a function or a class, or
- define a member function, a member class, a member enumeration, or a static data member of a class template or of a class nested within a class template, or
- define a member template of a class or class template, or
- be an alias-declaration.
A declaration (the top-level grammatical construct) can be a template-declaration, so these rules directly apply to the declaration.
On the other hand (i.e. for non-template classes), a declaration can also be a block-declaration [dcl.dcl]/1, which can be a simple-declaration, which can contain a decl-specifier-seq which can contain a type-specifier [dcl.type]/1 which can be a class-specifier which can declare a class o.O and using this type-specifier you could declare a variable:
(resolving one construct per line into its (possible) components)
declaration block-declaration simple-declaration decl-specifier-seqopt init-declarator-listopt ; type-secifier init-declarator-listopt ; class-specifier init-declarator-listopt ; class-head { member-specificationopt } init-declarator-listopt ; class-head { member-specificationopt } init-declarator ; class-head { member-specificationopt } declarator initializeropt ; class-head { member-specificationopt } ptr-declarator ; class-head { member-specificationopt } noptr-declarator ; class-head { member-specificationopt } declarator-id attribute-specifier-seqopt ; class-head { member-specificationopt } ...opt id-expression ;
Which now matches, say, struct something { int d; } somethingType;
But that would be a declaration of a variable, which is not allowed for the template case.