OSDN Git Service

/cp
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / ext / tmplattr3.C
1 // PR c++/17743
2
3 template<typename T>
4 struct X {
5   typedef char layout_type[sizeof(T)]
6   __attribute ((aligned(__alignof(double))));
7   layout_type data;
8 };
9
10 template<typename T>
11 struct Y {
12   typedef char layout_type[sizeof(T)]
13   __attribute ((aligned(__alignof(T))));
14   layout_type data;
15 };
16
17 template<typename T>
18 struct Z {
19   typedef char layout_type[sizeof(T)]
20   __attribute ((aligned(__alignof(T))));
21   struct Z2 {
22     layout_type data;
23   } in;
24 };
25
26 template<typename T>
27 struct A;
28
29 template <typename T>
30 struct A<T*> {
31   typedef char layout_type[sizeof(T)]
32   __attribute ((aligned(__alignof(T))));
33   layout_type data;
34 };
35
36 template<bool> struct StaticAssert;
37 template<> struct StaticAssert<true> {};
38
39 StaticAssert<__alignof(X<double>) == __alignof(double)> d1;
40 StaticAssert<__alignof(Y<double>) == __alignof(double)> d2;
41 StaticAssert<__alignof(Z<double>) == __alignof(double)> d3;
42 StaticAssert<__alignof(A<double*>) == __alignof(double)> d4;