Debian Codegraph @

gcc/testsuite/g++.dg/eh/init-temp2.C

raw
1 // PR c++/34196
2 // { dg-options "-O -Wuninitialized" }
3
4 template <class _Tp> class AutoPtr
5 {
6 _Tp* _M_ptr;
7
8 public:
9 explicit AutoPtr(_Tp* __p = 0) : _M_ptr(__p) {}
10
11 ~AutoPtr()
12 #if __cplusplus <= 201402L
13 throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++17 } } } }
14 #else
15 noexcept(false)
16 #endif
17 { delete _M_ptr; }
18 };
19
20 struct A
21 {
22 A() { }
23 ~A()
24 #if __cplusplus <= 201402L
25 throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++17 } } } }
26 #else
27 noexcept(false)
28 #endif
29 { throw 1; }
30 };
31
32 struct B
33 {
34 virtual ~B()
35 #if __cplusplus <= 201402L
36 throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++17 } } } }
37 #else
38 noexcept(false)
39 #endif
40 ;
41 };
42
43 B* f (const A &s) { throw 1; }
44
45 int
46 main()
47 {
48 AutoPtr<B> wt(f(A()));
49 }