[PATCH] Sema: When merging typedefs, handle records before merging attributes

Richard Smith richard at metafoo.co.uk
Mon Oct 7 11:31:14 PDT 2013


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 <mail at justinbogner.com> 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
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131007/f2e06750/attachment.html>


More information about the cfe-commits mailing list