Trying to compile the following code on different compilers gives me two different results:
struct S{}; struct T{S S;}; int main(){}
As you
@JesseGood provide a complete answer, but if you really want to do this without any error, you can use type's full name and it will work as follow:
struct S {}; struct T { ::S S; }; int main() {return 0;}
No there is no error, since S in your class is T::S and its type is ::S!
S
T::S
::S