* doc/invoke.texi: Document -std=c++17 and -std=gnu++17 and document
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.eh / cleanup2.C
blobced2394826c05617c93e1d414509e73b2a5b6e1f
1 // { dg-do run  }
2 //  Copyright (C) 1999 Free Software Foundation, Inc.
3 //  Contributed by Nathan Sidwell 21 Nov 1999 <nathan@acm.org>
5 // make sure we don't call base dtors, if we failed to call the
6 // base ctor due to exception throwing
8 #include <stdio.h>
10 static bool bad = false;
12 static int thrower ()
14   printf ("in %s\n", __PRETTY_FUNCTION__);
15   throw 0;
16   return 0;
19 struct X
21   X (int)
22 #if __cplusplus <= 201402L
23   throw (int)                   // { dg-warning "deprecated" "" { target { c++11 && { ! c++17 } } } }
24 #endif
25   ;
26   ~X () throw ();
29 X::X (int)
30 #if __cplusplus <= 201402L
31   throw (int)                   // { dg-warning "deprecated" "" { target { c++11 && { ! c++17 } } } }
32 #endif
33   {printf ("in ctor X %s\n", __PRETTY_FUNCTION__); bad = true;}
34 X::~X () throw ()
35   {printf ("in dtor X %s\n", __PRETTY_FUNCTION__); bad = true;}
37 struct X1 {};
38 struct Y : X
40   Y()
41 #if __cplusplus <= 201402L
42   throw (int)                   // { dg-warning "deprecated" "" { target { c++11 && { ! c++17 } } } }
43 #endif
44   ;
45   ~Y() throw ();
47 Y::Y()
48 #if __cplusplus <= 201402L
49   throw (int)                   // { dg-warning "deprecated" "" { target { c++11 && { ! c++17 } } } }
50 #endif
51   : X(thrower ())   // throws, so X::X is never called
52   {printf ("in ctor Y%s\n", __PRETTY_FUNCTION__); bad = true;}
53 Y::~Y() throw ()
54   {printf ("in dtor Y%s\n", __PRETTY_FUNCTION__); bad = true;}
56 int main ()
58   try
59     {
60       Y y;
61     }
62   catch (...)
63     {
64       printf ("caught\n");
65     }
66   return bad;