Debian Codegraph @

gcc/testsuite/g++.dg/cpp0x/noexcept34.C

raw
1 // PR c++/88294
2 // { dg-do compile { target c++11 } }
3
4 constexpr int foo (bool b) { return b; }
5
6 template<typename> struct A
7 {
8 constexpr int f () { return 0; }
9 bool b = true;
10 void g () noexcept (f()) { }
11 void g2 () noexcept (this->f()) { }
12 void g3 () noexcept (b) { } // { dg-error "use of .this. in a constant expression|use of parameter|.this. is not a constant" }
13 void g4 (int i) noexcept (i) { } // { dg-error "use of parameter" }
14 void g5 () noexcept (A::f()) { }
15 void g6 () noexcept (foo(b)) { } // { dg-error "use of .this. in a constant expression|use of parameter|.this. is not a constant" }
16 void g7 () noexcept (int{f()}) { }
17 };
18
19 int main ()
20 {
21 A<int> a;
22 a.g ();
23 a.g2 ();
24 a.g3 ();
25 a.g4 (1);
26 a.g5 ();
27 a.g6 ();
28 a.g7 ();
29 }