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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [g++.dg/] [cpp0x/] [trivial1.C] - Blame information for rev 307

Go to most recent revision | 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, trivial class types (Clause 9), arrays of such types and
5
// cv-qualified versions of these types (3.9.3) are collectively called
6
// trivial types.
7
 
8
// [class]/6:
9
// A trivially copyable class is a class that:
10
// * has no non-trivial copy constructors (12.8),
11
// * has no non-trivial copy assignment operators (13.5.3, 12.8), and
12
// * has a trivial destructor (12.4).
13
// A trivial class is a class that has a trivial default constructor (12.1)
14
// and is trivially copyable.
15
 
16
#include 
17
 
18
#define TRY(expr) static_assert (expr, #expr)
19
#define YES(type) TRY(std::is_trivial::value); \
20
  TRY(std::is_trivial::value); \
21
  TRY(std::is_trivial::value);
22
#define NO(type) TRY(!std::is_trivial::value); \
23
  TRY(!std::is_trivial::value); \
24
  TRY(!std::is_trivial::value);
25
 
26
struct A;
27
 
28
YES(int);
29
YES(__complex int);
30
YES(void *);
31
YES(int A::*);
32
typedef int (A::*pmf)();
33
YES(pmf);
34
 
35
struct A { ~A(); };
36
NO(A);
37
struct F: public A { int i; };
38
NO(F);
39
struct G: public A { A a; };
40
NO(G);
41
struct M { A a; };
42
NO(M);
43
 
44
class B
45
{
46
  int i;
47
  __complex int c;
48
  void *p;
49
  double ar[4];
50
  int A::* pm;
51
  int (A::*pmf)();
52
};
53
YES(B);
54
struct D: public B { };
55
YES(D);
56
struct E: public B { int q; };
57
YES(E);
58
struct D2: public B { };
59
YES(D2);
60
struct I: public D, public D2 { };
61
YES(I);
62
 
63
struct C
64
{
65
  int i;
66
private:
67
  int j;
68
};
69
YES(C);
70
struct H: public C { };
71
YES(H);
72
struct N { C c; };
73
YES(N);
74
 
75
struct J { virtual void f(); };
76
struct J2: J { };
77
NO(J);
78
NO(J2);
79
struct K { };
80
struct L: virtual K {};
81
YES(K);
82
NO(L);
83
 
84
// PR c++/41421
85
struct O { O(int); };
86
NO(O);

powered by: WebSVN 2.1.0

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