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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-dev/] [fsf-gcc-snapshot-1-mar-12/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [cpp0x/] [noexcept01.C] - Blame information for rev 783

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
// Test for noexcept-expression
2
// { dg-options "-std=c++0x -O2" }
3
 
4
#include 
5
 
6
#define SA(X) static_assert(X, #X)
7
 
8
void f();
9
void g() throw();
10
SA(noexcept(g()));
11
SA(!noexcept(f()));
12
SA(!noexcept(throw 1));
13
SA(noexcept(42));
14
 
15
struct A
16
{
17
  virtual ~A();
18
};
19
 
20
struct B: public A
21
{
22
  virtual ~B();
23
};
24
 
25
A* ap;
26
 
27
struct C { };
28
C* cp;
29
 
30
SA (noexcept (dynamic_cast(ap)));
31
SA (!noexcept (dynamic_cast(*ap)));
32
SA (!noexcept (typeid (*ap)));
33
SA (noexcept (typeid (*cp)));
34
 
35
SA (!noexcept (true ? 1 : throw 1));
36
SA (!noexcept (true || true ? 1 : throw 1));
37
 
38
SA (noexcept (C()));
39
 
40
struct D
41
{
42
  D() throw();
43
};
44
 
45
SA (noexcept (D()));
46
 
47
struct E
48
{
49
  E() throw();
50
  ~E();
51
};
52
 
53
SA (!noexcept (E()));
54
 
55
struct F
56
{
57
  virtual void f();
58
};
59
 
60
SA (noexcept (F()));
61
 
62
struct G
63
{
64
  G() = default;
65
  ~G() = default;
66
};
67
 
68
SA (noexcept (G()));
69
 
70
template 
71
void tf()
72
{
73
  SA (noexcept (T()) == b);
74
}
75
 
76
template void tf();
77
template void tf();
78
 
79
// Make sure that noexcept uses the declared exception-specification, not
80
// any knowledge we might have about whether or not the function really
81
// throws.
82
void h() { }
83
SA(!noexcept(h()));

powered by: WebSVN 2.1.0

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