<div><div class="gmail_extra"><div class="gmail_quote">On 21 Sep 2016 4:38 pm, "Petr Hosek via cfe-dev" <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span style="color:rgb(33,33,33);font-family:"helvetica neue",helvetica,arial,sans-serif;font-size:13px">We ran into an error when trying to build one of our existing projects with Clang. The minimal example looks as follows:</span><div style="color:rgb(33,33,33);font-family:"helvetica neue",helvetica,arial,sans-serif;font-size:13px"><br></div><div style="color:rgb(33,33,33);font-family:"helvetica neue",helvetica,arial,sans-serif;font-size:13px"><div>template <typename S> struct Foo {</div><div>  struct Bar {</div><div>    using Baz = Foo<S>;</div><div>  };</div><div>  template <typename T> struct Qux {</div><div>    friend struct Bar::Baz;</div><div>  };</div><div>};</div><div><br></div><div>Foo<int>::Qux<int> qux;</div></div><div style="color:rgb(33,33,33);font-family:"helvetica neue",helvetica,arial,sans-serif;font-size:13px"><br></div><div style="color:rgb(33,33,33);font-family:"helvetica neue",helvetica,arial,sans-serif;font-size:13px">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.</div><div style="color:rgb(33,33,33);font-family:"helvetica neue",helvetica,arial,sans-serif;font-size:13px"><br></div><div style="color:rgb(33,33,33);font-family:"helvetica neue",helvetica,arial,sans-serif;font-size:13px">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)?</div></div></blockquote></div></div></div><div><br></div><div>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.</div><div><br></div><div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div></div>