This is legal, but probably not a good idea.
From [basic.scope.pdecl]/6:
[...] — for an elaborated-type-specifier of the form
class-key identifier
if the elaborated-type-specifier is used in the decl-specifier-seq or parameter-declaration-clause of a function defined in namespace scope, the identifier is declared as a class-name in the namespace that contains the declaration [...]
For example:
namespace mine { struct T* foo(struct S *); // ^^^^^^^^^---------------- decl-specifier-seq // ^^^^^^^^^^--- parameter-declaration-clause }
This introduces T and S as class-names and foo as a function name into namespace mine.
Note that the behavior is different in C; the struct name is only valid within the scope of the function.
6.2.1 Scopes of identifiers
4 - [...] If the declarator or type specifier that declares the identifier appears [...] within the list of parameter declarations in a function definition, the identifier has block scope, which terminates at the end of the associated block. If the declarator or type specifier that declares the identifier appears within the list of parameter declarations in a function prototype (not part of a function definition), the identifier has function prototype scope, which terminates at the end of the function declarator.
gcc gives an appropriate warning for this usage in C code:
a.c:3:18: warning: ‘struct Test’ declared inside parameter list void* foo(struct Test* t) ^ a.c:3:18: warning: its scope is only this definition or declaration, which is probably not what you want