[cfe-dev] Elaborated type refers to a type alias

Petr Hosek via cfe-dev cfe-dev at lists.llvm.org
Wed Sep 21 16:37:50 PDT 2016

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

template <typename S> struct Foo {
  struct Bar {
    using Baz = Foo<S>;
  template <typename T> struct Qux {
    friend struct Bar::Baz;

Foo<int>::Qux<int> 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)?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160921/43927e03/attachment.html>

More information about the cfe-dev mailing list