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.

Please also add to your testcase:

struct TDS tds2; // no warning, attribute only applies to the typedef.

... and for good measure:

typedef struct S { char c; } S __attribute__((aligned(8)));
S a;
struct S b;
static_assert(alignof(a) == 8, "");
static_assert(alignof(b) == 1, "");


On Fri, Oct 4, 2013 at 1:01 PM, Justin Bogner <[email protected]> wrote:

> The following is warning that "attribute declaration must precede
> definition" in C++ in ToT:
>
> typedef struct S {
>   // ...
> } S __attribute__((...));
>
> This started happening in r186373. The attached patch fixes when
> mergeDeclAttributes happens in MergeTypedefNameDecl to avoid this. Okay
> to commit?
>
>
> _______________________________________________
> cfe-commits mailing list
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to