OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.dg/] [cpp0x/] [std-layout1.C] - Blame information for rev 338

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 301 jeremybenn
// { dg-options "-std=c++0x" }
2
 
3
// [basic.types]/10:
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.
7
 
8
// [class]/7:
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.
19
 
20
#include 
21
 
22
#define TRY(expr) static_assert (expr, #expr)
23
#define YES(type) TRY(std::is_standard_layout::value); \
24
  TRY(std::is_standard_layout::value); \
25
  TRY(std::is_standard_layout::value);
26
#define NO(type) TRY(!std::is_standard_layout::value); \
27
  TRY(!std::is_standard_layout::value); \
28
  TRY(!std::is_standard_layout::value);
29
#define NONPOD(type) TRY(!std::is_pod::value); \
30
  TRY(!std::is_pod::value); \
31
  TRY(!std::is_pod::value);
32
 
33
struct A;
34
 
35
YES(int);
36
YES(__complex int);
37
YES(void *);
38
YES(int A::*);
39
typedef int (A::*pmf)();
40
YES(pmf);
41
 
42
struct A { ~A(); };
43
YES(A);
44
NONPOD(A);
45
struct F: public A { int i; };
46
YES(F);
47
NONPOD(F);
48
struct G: public A { A a; };
49
NO(G);
50
struct M { A a; };
51
YES(M);
52
 
53
class B
54
{
55
  int i;
56
  __complex int c;
57
  void *p;
58
  double ar[4];
59
  int A::* pm;
60
  int (A::*pmf)();
61
};
62
YES(B);
63
struct D: public B { };
64
YES(D);
65
struct E: public B { int q; };
66
NO(E);
67
struct D2: public B { };
68
YES(D2);
69
struct I: public D, public D2 { };
70
NO(I);
71
 
72
struct C
73
{
74
  int i;
75
private:
76
  int j;
77
};
78
NO(C);
79
struct H: public C { };
80
NO(H);
81
struct N { C c; };
82
NO(N);
83
 
84
struct J { virtual void f(); };
85
struct J2: J { };
86
NO(J);
87
NO(J2);
88
struct K { };
89
struct L: virtual K {};
90
YES(K);
91
NO(L);

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.