From a practical point of view, I understand that both typedef and test are somewhat "redundant" and they need to be removed if we want the following code to compile:
template< typename type_t > typedef struct tagTest { int a; } test;
However, I thought the typedef declaration set was a subset of the declaration set. They just got this specific qualifier. It was my rationalization for
typedef struct tagTest { int a; } test;
by entering the identifier test and declaring the tagTest structure. If this interpretation is correct, then the next paragraph from the standard should allow a template typedef (although not with the value specified by the using keyword).
The declaration in the template declaration shall - (1.1) declare or define a function, class or variable, or - (1.2) define a member function, member class, element enumeration or static data member of a class template or class nested in a class template, or (1.3) define a member template of a class or class template, or - (1.4) be a declaration of aliases.
I do not see a mistake in my reasoning, but the conclusion is illegal.
What are the relevant parts of the standard that solve the above puzzle?
UPDATE The above part uses the fact that typedef struct declares a structure. The typedef , as I understand it, implies that any declared variables are indeed types. That is, typedef updates test from a simple variable to a type equivalent to the declared tagTest . This is why the following code compiles (albeit with a warning).
typedef struct tagTest { int a; }; tagTest t;
One of the answers is responsible for the extra test . But you can use typedef without a declarator because "Init-declarator-list is optional when declaring a named class / structure / union or named enumeration"