PR c++/38611 - missing -Wattributes on a typedef with attribute aligned
[platform/upstream/gcc.git] / gcc / testsuite / g++.dg / Wattributes.C
1 // PR c++/38611
2 // { dg-do compile }
3
4 struct A { unsigned char a [272]; };
5
6 typedef struct __attribute__ ((aligned (128))) A B;   // { dg-warning "attributes ignored" }
7 typedef struct __attribute__ ((__may_alias__)) A C;   // { dg-warning "attributes ignored" }
8
9 #ifndef __cplusplus
10 #  define alignof       _Alignof
11 #  define static_assert _Static_assert
12 #elif __cplusplus < 201103L
13 #  define alignof __alignof__
14 #  define static_assert(expr, ignore) typedef int Assert [(expr) ? 1 : -1]
15 #endif
16
17 #define SA(expr) static_assert ((expr), #expr)
18
19 SA (alignof (struct A) == alignof (B));
20