1 // { dg-do compile { target c++11 } }
2 // { dg-additional-options "-Wno-deprecated-declarations" { target c++2a } }
5 // Scalar types, standard-layout class types (Clause 9), arrays of such
6 // types and cv-qualified versions of these types (3.9.3) are collectively
7 // called standard-layout types.
10 // A standard-layout class is a class that:
11 // * has no non-static data members of type non-standard-layout class (or
12 // array of such types) or reference,
13 // * has no virtual functions (10.3) and no virtual base classes (10.1),
14 // * has the same access control (Clause 11) for all non-static data members,
15 // * has no non-standard-layout base classes,
16 // * either has no non-static data members in the most-derived class and at
17 // most one base class with non-static data members, or has no base classes
18 // with non-static data members, and
19 // * has no base classes of the same type as the first non-static data member.
21 #include <type_traits>
23 #define TRY(expr) static_assert (expr, #expr)
24 #define YES(type) TRY(std::is_standard_layout<type>::value); \
25 TRY(std::is_standard_layout<type[]>::value); \
26 TRY(std::is_standard_layout<const volatile type>::value)
27 #define NO(type) TRY(!std::is_standard_layout<type>::value); \
28 TRY(!std::is_standard_layout<type[]>::value); \
29 TRY(!std::is_standard_layout<const volatile type>::value)
30 #define NONPOD(type) TRY(!std::is_pod<type>::value); \
31 TRY(!std::is_pod<type[]>::value); \
32 TRY(!std::is_pod<const volatile type>::value)
40 typedef int (A::*pmf)();
46 struct F: public A { int i; };
49 struct G: public A { A a; };
64 struct D: public B { };
66 struct E: public B { int q; };
68 struct D2: public B { };
70 struct I: public D, public D2 { };
80 struct H: public C { };
85 struct J { virtual void f(); };
90 struct L: virtual K {};