comparison gcc/testsuite/g++.dg/cpp0x/noexcept03.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 04ced10e8804
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 // Runtime test for noexcept-specification. 1 // Runtime test for noexcept-specification.
2 // { dg-options "-Wnoexcept" } 2 // { dg-options "-Wnoexcept" }
3 // { dg-do run { target nonpic } } 3 // { dg-do run { target { nonpic || pie_enabled } } }
4 // { dg-require-effective-target c++11 } 4 // { dg-require-effective-target c++11 }
5 5
6 #include <exception> 6 #include <exception>
7 #include <cstdlib> 7 #include <cstdlib>
8 8
33 void f2(T a) noexcept (noexcept (f (a))) 33 void f2(T a) noexcept (noexcept (f (a)))
34 { 34 {
35 f(a); 35 f(a);
36 } 36 }
37 37
38 struct A { A() { } }; // { dg-warning "does not throw" } 38 struct A { A() { } }; // { dg-message "does not throw" }
39 39
40 int main() 40 int main()
41 { 41 {
42 // noexcept(false) allows throw. 42 // noexcept(false) allows throw.
43 try { f(); } catch (int) { } 43 try { f(); } catch (int) { }