Elaborated type refers to a type alias

We ran into an error when trying to build one of our existing projects with Clang. The minimal example looks as follows:

template struct Foo {
struct Bar {
using Baz = Foo;
template struct Qux {
friend struct Bar::Baz;

Foo::Qux qux;

When trying build this example with Clang, it produces the following error: test.cc:6:24: error: elaborated type refers to a type alias. However, GCC handles this example just fine.

IIUC in this case Clang follows the C++ standard which specifies that elaborated type specifier cannot refer to a type alias. However, I would like to ask if anyone can explain the underlying motivation? In this case it seems to be pretty clear what Baz refers to. Is there any reason why Clang cannot allow it (except for strictly adhering to standards)?

You can fix your code by deleting the ‘struct’ keyword from the friend declaration. Vendor extensions have a history of doing harm to the C++ language, and it seems hard to justify one here given the correct code is simpler than the incorrect code.