1 // { dg-options "-std=c++0x" }
4 // Scalar types, standard-layout class types (Clause 9), arrays of such
5 // types and cv-qualified versions of these types (3.9.3) are collectively
6 // called standard-layout types.
9 // A standard-layout class is a class that:
10 // * has no non-static data members of type non-standard-layout class (or
11 // array of such types) or reference,
12 // * has no virtual functions (10.3) and no virtual base classes (10.1),
13 // * has the same access control (Clause 11) for all non-static data members,
14 // * has no non-standard-layout base classes,
15 // * either has no non-static data members in the most-derived class and at
16 // most one base class with non-static data members, or has no base classes
17 // with non-static data members, and
18 // * has no base classes of the same type as the first non-static data member.
20 #include <type_traits>
22 #define TRY(expr) static_assert (expr, #expr)
23 #define YES(type) TRY(std::is_standard_layout<type>::value); \
24 TRY(std::is_standard_layout<type[]>::value); \
25 TRY(std::is_standard_layout<const volatile type>::value);
26 #define NO(type) TRY(!std::is_standard_layout<type>::value); \
27 TRY(!std::is_standard_layout<type[]>::value); \
28 TRY(!std::is_standard_layout<const volatile type>::value);
29 #define NONPOD(type) TRY(!std::is_pod<type>::value); \
30 TRY(!std::is_pod<type[]>::value); \
31 TRY(!std::is_pod<const volatile type>::value);
39 typedef int (A::*pmf)();
45 struct F: public A { int i; };
48 struct G: public A { A a; };
63 struct D: public B { };
65 struct E: public B { int q; };
67 struct D2: public B { };
69 struct I: public D, public D2 { };
79 struct H: public C { };
84 struct J { virtual void f(); };
89 struct L: virtual K {};