<div dir="ltr">Thanks for the report, should be fixed in r204423.<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Mar 18, 2014 at 9:33 PM, Tom Honermann <span dir="ltr"><<a href="mailto:thonermann@coverity.com" target="_blank">thonermann@coverity.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">According to the Itanium C++ ABI, The unnamed structures nested in struct S below should be assigned the names 'N1SUt_' and 'N1SUt0_' respectively.  And indeed, Clang versions 3.3 and newer do assign these names when compiling the source directly.  However, when the source is first emitted to a .ast file and then compiled, both of the unnamed structures are assigned the same mangled name (presumably because mangling discriminators are not being preserved in the .ast file).  For the test case below, this results in both instantiations of the tf() template function receiving the same name and one being discarded.<br>

<br>
I tested this behavior with Clang versions 3.3 through trunk (pulled tonight).  Clang 3.2 produces consistent behavior, though the names generated in that release don't conform to the Itanium ABI.<br>
<br>
Warnings regarding the use of an unnamed type as a template argument are issued when compiling the test case below.  This test case was contrived to demonstrate that both unnamed types are being assigned the same name.<br>

<br>
$ cat t.cpp<br>
struct S {<br>
  struct {<br>
    int i;<br>
  } s1;<br>
  struct {<br>
    int i;<br>
  } s2;<br>
} s;<br>
<br>
template<typename T><br>
void tf(T t) {}<br>
<br>
void f() {<br>
  tf(s.s1);<br>
  tf(s.s2);<br>
}<br>
<br>
$ clang -c t.cpp<br>
...<br>
<br>
$ nm t.o<br>
0000000000000000 T _Z1fv<br>
0000000000000000 W _Z2tfIN1SUt0_EEvT_<br>
0000000000000000 W _Z2tfIN1SUt_EEvT_<br>
0000000000000000 B s<br>
<br>
$ clang -emit-ast t.cpp<br>
...<br>
<br>
$ clang -c t.ast<br>
<br>
$ nm t.o<br>
0000000000000000 T _Z1fv<br>
0000000000000000 W _Z2tfIN1SUt_EEvT_<br>
0000000000000000 B s<br>
<br>
Tom.<br>
______________________________<u></u>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br></div>