Actually, in C++, it's illegal to define a type in a parameter or return type, named or not. See C++11[diff.decl]:
Change: In C++, types may not be defined in return or parameter types. In C, these type definitions are allowed
So the actual problem is the first case being accepted, not the second one being rejected.