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.0rc3/] [gcc/] [testsuite/] [g++.dg/] [ext/] [has_nothrow_copy-1.C] - Blame information for rev 516

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 301 jeremybenn
// { dg-do "run" }
2
#include 
3
 
4
struct A
5
{
6
  double a;
7
  double b;
8
};
9
 
10
struct B
11
{
12
  A a;
13
};
14
 
15
struct C
16
: public A { };
17
 
18
struct D
19
{
20
  D(const D&) throw() { }
21
};
22
 
23
struct E
24
{
25
  E(const E&) throw(int) { }
26
};
27
 
28
struct E1
29
{
30
  E1(const E1&) throw(int) { throw int(); }
31
};
32
 
33
struct F
34
{
35
  F() throw() { }
36
};
37
 
38
struct G
39
{
40
  G() throw(int) { throw int(); }
41
};
42
 
43
struct H
44
{
45
  H(H&) throw(int) { }
46
};
47
 
48
struct H1
49
{
50
  H1(H1&) throw(int) { throw int(); }
51
};
52
 
53
struct I
54
{
55
  I(I&) throw(int) { }
56
  I(const I&) throw() { }
57
};
58
 
59
struct I1
60
{
61
  I1(I1&) throw(int) { throw int(); }
62
  I1(const I1&) throw() { }
63
};
64
 
65
struct J
66
{
67
  J(J&) throw() { }
68
  J(const J&) throw() { }
69
  J(volatile J&) throw() { }
70
  J(const volatile J&) throw() { }
71
};
72
 
73
template
74
  bool
75
  f()
76
  { return __has_nothrow_copy(T); }
77
 
78
template
79
  class My
80
  {
81
  public:
82
    bool
83
    f()
84
    { return !!__has_nothrow_copy(T); }
85
  };
86
 
87
template
88
  class My2
89
  {
90
  public:
91
    static const bool trait = __has_nothrow_copy(T);
92
  };
93
 
94
template
95
  const bool My2::trait;
96
 
97
template
98
  struct My3_help
99
  { static const bool trait = b; };
100
 
101
template
102
  const bool My3_help::trait;
103
 
104
template
105
  class My3
106
  {
107
  public:
108
    bool
109
    f()
110
    { return My3_help::trait; }
111
  };
112
 
113
#define PTEST(T) (__has_nothrow_copy(T) && f() \
114
                  && My().f() && My2::trait && My3().f())
115
 
116
#define NTEST(T) (!__has_nothrow_copy(T) && !f() \
117
                  && !My().f() && !My2::trait && !My3().f())
118
 
119
int main()
120
{
121
  assert (PTEST (int));
122
  assert (NTEST (int (int)));
123
  assert (NTEST (void));
124
  assert (PTEST (A));
125
  assert (PTEST (B));
126
  assert (PTEST (C));
127
  assert (PTEST (C[]));
128
  assert (PTEST (D));
129
  assert (NTEST (E));
130
  assert (NTEST (E1));
131
  assert (PTEST (F));
132
  assert (PTEST (G));
133
  assert (NTEST (H));
134
  assert (NTEST (H1));
135
  assert (NTEST (I));
136
  assert (NTEST (I1));
137
  assert (PTEST (J));
138
 
139
  return 0;
140
}

powered by: WebSVN 2.1.0

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