<div dir="ltr"><div>This doesn't look right in the case where the attribute is on a typedef defined inside a class in C++. Instead, I think we should only perform the merging if Old was a TypedefNameDecl.</div><div><br>
</div><div>Please also add to your testcase:</div><div><br></div><div>struct TDS tds2; // no warning, attribute only applies to the typedef.</div><div><br></div><div>... and for good measure:</div><div><br></div><div>typedef struct S { char c; } S __attribute__((aligned(8)));</div>
<div>S a;</div><div>struct S b;</div><div>static_assert(alignof(a) == 8, "");</div><div>static_assert(alignof(b) == 1, "");</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Oct 4, 2013 at 1:01 PM, Justin Bogner <span dir="ltr"><<a href="mailto:mail@justinbogner.com" target="_blank">mail@justinbogner.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The following is warning that "attribute declaration must precede<br>
definition" in C++ in ToT:<br>
<br>
typedef struct S {<br>
  // ...<br>
} S __attribute__((...));<br>
<br>
This started happening in r186373. The attached patch fixes when<br>
mergeDeclAttributes happens in MergeTypedefNameDecl to avoid this. Okay<br>
to commit?<br>
<br>
<br>_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div><br></div>