diff options
Diffstat (limited to 'gcc')
100 files changed, 713 insertions, 198 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a59d25b..e325164 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2016-12-08 Jakub Jelinek <jakub@redhat.com> + + P0003R5 - removal of dynamic exception specification from C++17 + * parser.c (cp_parser_exception_specification_opt): For C++17 + error out on throw ( type-id-list ), for C++11 and C++14 issue + -Wdeprecated warning on it. Formatting fix. Treat throw() + in C++17 as noexcept(true). + 2016-12-07 Martin Jambor <mjambor@suse.cz> PR c++/78589 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 08f5f9e..70e5fb3 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -23786,8 +23786,8 @@ cp_parser_exception_specification_opt (cp_parser* parser) token = cp_lexer_peek_token (parser->lexer); /* Is it a noexcept-specification? */ - type_id_list = cp_parser_noexcept_specification_opt(parser, true, NULL, - false); + type_id_list = cp_parser_noexcept_specification_opt (parser, true, NULL, + false); if (type_id_list != NULL_TREE) return type_id_list; @@ -23795,12 +23795,7 @@ cp_parser_exception_specification_opt (cp_parser* parser) if (!cp_parser_is_keyword (token, RID_THROW)) return NULL_TREE; -#if 0 - /* Enable this once a lot of code has transitioned to noexcept? */ - if (cxx_dialect >= cxx11 && !in_system_header_at (input_location)) - warning (OPT_Wdeprecated, "dynamic exception specifications are " - "deprecated in C++0x; use %<noexcept%> instead"); -#endif + location_t loc = token->location; /* Consume the `throw'. */ cp_lexer_consume_token (parser->lexer); @@ -23821,7 +23816,23 @@ cp_parser_exception_specification_opt (cp_parser* parser) type_id_list = cp_parser_type_id_list (parser); /* Restore the saved message. */ parser->type_definition_forbidden_message = saved_message; + + if (cxx_dialect >= cxx1z) + { + error_at (loc, "ISO C++1z does not allow dynamic exception " + "specifications"); + type_id_list = NULL_TREE; + } + else if (cxx_dialect >= cxx11 && !in_system_header_at (loc)) + warning_at (loc, OPT_Wdeprecated, + "dynamic exception specifications are deprecated in C++11;" + " use %<noexcept%> instead"); } + /* In C++17, throw() is equivalent to noexcept (true). throw() + is deprecated in C++11 and above as well, but is still widely used, + so don't warn about it yet. */ + else if (cxx_dialect >= cxx1z) + type_id_list = noexcept_true_spec; else type_id_list = empty_except_spec; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bf6db37..b6b0096 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,17 +1,118 @@ +2016-12-08 Jakub Jelinek <jakub@redhat.com> + + P0003R5 - removal of dynamic exception specification from C++17 + * g++.dg/compat/eh/ctor1.h: Adjust for deprecation of + throw (type-id-list) in C++11 and C++14 and removal in C++17. + * g++.dg/compat/eh/ctor1_y.C: Likewise. + * g++.dg/compat/eh/new1_x.C: Likewise. + * g++.dg/compat/eh/new1_y.C: Likewise. + * g++.dg/compat/eh/spec3_x.C: Likewise. + * g++.dg/compat/eh/spec3_y.C: Likewise. + * g++.dg/compat/eh/template1.h: Likewise. + * g++.dg/compat/eh/template1_y.C: Likewise. + * g++.dg/compat/eh/unexpected1_x.C: Likewise. + * g++.dg/compat/eh/unexpected1_y.C: Likewise. + * g++.dg/cpp0x/auto9.C: Likewise. + * g++.dg/cpp0x/defaulted23.C: Likewise. + * g++.dg/cpp0x/error5.C: Likewise. + * g++.dg/cpp0x/lambda/lambda-eh2.C: Likewise. + * g++.dg/cpp0x/noexcept02.C: Likewise. + * g++.dg/cpp0x/noexcept07.C: Likewise. + * g++.dg/cpp0x/noexcept08.C: Likewise. + * g++.dg/cpp0x/noexcept19.C: Likewise. + * g++.dg/cpp0x/variadic73.C: Likewise. + * g++.dg/cpp0x/variadic-throw.C: Likewise. + * g++.dg/cpp1z/noexcept-type1.C: Likewise. + * g++.dg/eh/async-unwind2.C: Likewise. + * g++.dg/eh/cond4.C: Likewise. + * g++.dg/eh/delete1.C: Likewise. + * g++.dg/eh/ehopt1.C: Likewise. + * g++.dg/eh/forced3.C: Likewise. + * g++.dg/eh/forced4.C: Likewise. + * g++.dg/eh/init-temp2.C: Likewise. + * g++.dg/eh/pr38662.C: Likewise. + * g++.dg/eh/pr41819.C: Likewise. + * g++.dg/eh/shadow1.C: Likewise. + * g++.dg/eh/spec2.C: Likewise. + * g++.dg/eh/spec3.C: Likewise. + * g++.dg/eh/spec5.C: Likewise. + * g++.dg/eh/spec6.C: Likewise. + * g++.dg/eh/spec7.C: Likewise. + * g++.dg/eh/spec8.C: Likewise. + * g++.dg/eh/spec9.C: Likewise. + * g++.dg/eh/template1.C: Likewise. + * g++.dg/eh/unexpected1.C: Likewise. + * g++.dg/ext/has_nothrow_assign.C: Likewise. + * g++.dg/ext/has_nothrow_constructor.C: Likewise. + * g++.dg/ext/has_nothrow_copy-1.C: Likewise. + * g++.dg/ext/has_nothrow_copy-2.C: Likewise. + * g++.dg/ext/has_nothrow_copy-4.C: Likewise. + * g++.dg/ext/has_nothrow_copy-5.C: Likewise. + * g++.dg/ext/has_nothrow_copy-6.C: Likewise. + * g++.dg/ext/has_nothrow_copy-7.C: Likewise. + * g++.dg/gcov/gcov-7.C: Likewise. + * g++.dg/init/new13.C: Likewise. + * g++.dg/init/new25.C: Likewise. + * g++.dg/lookup/exception1.C: Likewise. + * g++.dg/opt/noreturn-1.C: Likewise. + * g++.dg/other/error3.C: Likewise. + * g++.dg/rtti/crash3.C: Likewise. + * g++.dg/template/eh2.C: Likewise. + * g++.dg/template/error36.C: Likewise. + * g++.dg/tm/pr46567.C: Likewise. + * g++.dg/tm/pr47340.C: Likewise. + * g++.dg/torture/pr46364.C: Likewise. + * g++.dg/torture/pr49394.C: Likewise. + * g++.dg/torture/pr52918-1.C: Likewise. + * g++.dg/torture/pr57190.C: Likewise. + * g++.dg/torture/stackalign/eh-alloca-1.C: Likewise. + * g++.dg/torture/stackalign/eh-fastcall-1.C: Likewise. + * g++.dg/torture/stackalign/eh-global-1.C: Likewise. + * g++.dg/torture/stackalign/eh-inline-1.C: Likewise. + * g++.dg/torture/stackalign/eh-inline-2.C: Likewise. + * g++.dg/torture/stackalign/eh-thiscall-1.C: Likewise. + * g++.dg/torture/stackalign/eh-vararg-1.C: Likewise. + * g++.dg/torture/stackalign/eh-vararg-2.C: Likewise. + * g++.dg/tree-ssa/pr45605.C: Likewise. + * g++.dg/warn/Wreturn-type-3.C: Likewise. + * g++.old-deja/g++.eh/badalloc1.C: Likewise. + * g++.old-deja/g++.eh/cleanup2.C: Likewise. + * g++.old-deja/g++.eh/spec1.C: Likewise. + * g++.old-deja/g++.eh/spec2.C: Likewise. + * g++.old-deja/g++.eh/spec3.C: Likewise. + * g++.old-deja/g++.eh/spec4.C: Likewise. + * g++.old-deja/g++.eh/spec6.C: Likewise. + * g++.old-deja/g++.eh/throw1.C: Likewise. + * g++.old-deja/g++.eh/throw2.C: Likewise. + * g++.old-deja/g++.eh/tmpl1.C: Likewise. + * g++.old-deja/g++.eh/tmpl3.C: Likewise. + * g++.old-deja/g++.mike/eh15.C: Likewise. + * g++.old-deja/g++.mike/eh25.C: Likewise. + * g++.old-deja/g++.mike/eh33.C: Likewise. + * g++.old-deja/g++.mike/eh34.C: Likewise. + * g++.old-deja/g++.mike/eh50.C: Likewise. + * g++.old-deja/g++.mike/eh51.C: Likewise. + * g++.old-deja/g++.mike/eh55.C: Likewise. + * g++.old-deja/g++.mike/p10416.C: Likewise. + * g++.old-deja/g++.other/crash28.C: Likewise. + * g++.old-deja/g++.other/crash30.C: Likewise. + * g++.old-deja/g++.other/new7.C: Likewise. + * g++.old-deja/g++.pt/ehspec1.C: Likewise. + * g++.old-deja/g++.robertl/eb123.C: Likewise. + 2016-12-08 Naveen H.S <Naveen.Hurugalawadi@cavium.com> - * gcc.target/aarch64/pr78382.c : New Testcase. + * gcc.target/aarch64/pr78382.c: New testcase. 2016-12-08 Andrew Pinski <apinski@cavium.com> - * gcc.target/aarch64/pr71112.c : New Testcase. + * gcc.target/aarch64/pr71112.c: New testcase. 2016-12-07 Martin Sebor <msebor@redhat.com> PR middle-end/77784 PR middle-end/78149 PR middle-end/78138 - * c-c++-common/Wsizeof-pointer-memaccess2.c: Adjust expected diagnostic. * g++.dg/ext/builtin-object-size3.C (bar): Same. * g++.dg/ext/strncpy-chk1.C: Same. @@ -84,7 +185,7 @@ 2016-12-07 Naveen H.S <Naveen.Hurugalawadi@cavium.com> - * gcc.target/aarch64/pr71727.c : New Testcase. + * gcc.target/aarch64/pr71727.c: New testcase. 2016-12-06 Tom de Vries <tom@codesourcery.com> @@ -873,23 +974,23 @@ 2016-11-23 Naveen H.S <Naveen.Hurugalawadi@caviumnetworks.com> - * gcc.target/aarch64/ldp_stp_1.c : Add -mcpu=generic. - * gcc.target/aarch64/store-pair-1.c : Likewise. + * gcc.target/aarch64/ldp_stp_1.c: Add -mcpu=generic. + * gcc.target/aarch64/store-pair-1.c: Likewise. 2016-11-23 Naveen H.S <Naveen.Hurugalawadi@caviumnetworks.com> - * gcc.target/aarch64/fmaxmin.c : Add -fno-vect-cost-model. - * gcc.target/aarch64/fmul_fcvt_2.c : Likewise. - * gcc.target/aarch64/vect-abs-compile.c : Likewise. - * gcc.target/aarch64/vect-clz.c : Likewise. - * gcc.target/aarch64/vect-fcm-eq-d.c : Likewise. - * gcc.target/aarch64/vect-fcm-ge-d.c : Likewise. - * gcc.target/aarch64/vect-fcm-gt-d.c : Likewise. - * gcc.target/aarch64/vect-fmovd-zero.c : Likewise. - * gcc.target/aarch64/vect-fmovd.c : Likewise. - * gcc.target/aarch64/vect-fmovf-zero.c : Likewise. - * gcc.target/aarch64/vect-fmovf.c : Likewise. - * gcc.target/aarch64/vect_ctz_1.c : Likewise. + * gcc.target/aarch64/fmaxmin.c: Add -fno-vect-cost-model. + * gcc.target/aarch64/fmul_fcvt_2.c: Likewise. + * gcc.target/aarch64/vect-abs-compile.c: Likewise. + * gcc.target/aarch64/vect-clz.c: Likewise. + * gcc.target/aarch64/vect-fcm-eq-d.c: Likewise. + * gcc.target/aarch64/vect-fcm-ge-d.c: Likewise. + * gcc.target/aarch64/vect-fcm-gt-d.c: Likewise. + * gcc.target/aarch64/vect-fmovd-zero.c: Likewise. + * gcc.target/aarch64/vect-fmovd.c: Likewise. + * gcc.target/aarch64/vect-fmovf-zero.c: Likewise. + * gcc.target/aarch64/vect-fmovf.c: Likewise. + * gcc.target/aarch64/vect_ctz_1.c: Likewise. 2016-11-23 Peter Bergner <bergner@vnet.ibm.com> @@ -7061,7 +7162,7 @@ 2016-07-28 Paul Thomas <pault@gcc.gnu.org> PR fortran/71883 - * gfortran.dg/pr71883.f90 : New test. + * gfortran.dg/pr71883.f90: New test. 2016-07-28 Yuri Rumyantsev <ysrumyan@gmail.com> @@ -14685,7 +14786,7 @@ 2016-02-20 Paul Thomas <pault@gcc.gnu.org> PR fortran/69423 - * gfortran.dg/deferred_character_15.f90 : New test. + * gfortran.dg/deferred_character_15.f90: New test. 2016-02-20 Dominique d'Humieres <dominiq@lps.ens.fr> diff --git a/gcc/testsuite/g++.dg/compat/eh/ctor1.h b/gcc/testsuite/g++.dg/compat/eh/ctor1.h index 9ad1860..e88a62d 100644 --- a/gcc/testsuite/g++.dg/compat/eh/ctor1.h +++ b/gcc/testsuite/g++.dg/compat/eh/ctor1.h @@ -5,6 +5,12 @@ struct Foo struct Bar { - ~Bar () throw(int); + ~Bar () +#if __cplusplus < 201103L + throw(int) +#else + noexcept(false) +#endif + ; Foo f; }; diff --git a/gcc/testsuite/g++.dg/compat/eh/ctor1_y.C b/gcc/testsuite/g++.dg/compat/eh/ctor1_y.C index ca1cf38..5478bb7 100644 --- a/gcc/testsuite/g++.dg/compat/eh/ctor1_y.C +++ b/gcc/testsuite/g++.dg/compat/eh/ctor1_y.C @@ -7,7 +7,12 @@ Foo::~Foo() was_f_in_Bar_destroyed=true; } -Bar::~Bar() throw(int) +Bar::~Bar() +#if __cplusplus < 201103L +throw(int) +#else +noexcept(false) +#endif { throw 1; } diff --git a/gcc/testsuite/g++.dg/compat/eh/new1_x.C b/gcc/testsuite/g++.dg/compat/eh/new1_x.C index 1212871..23ac80b 100644 --- a/gcc/testsuite/g++.dg/compat/eh/new1_x.C +++ b/gcc/testsuite/g++.dg/compat/eh/new1_x.C @@ -4,7 +4,11 @@ extern "C" void exit (int); extern "C" void abort (void); -extern void * operator new[] (std::size_t s) throw (std::bad_alloc); +extern void * operator new[] (std::size_t s) +#if __cplusplus < 201103L +throw (std::bad_alloc) +#endif +; extern void operator delete[] (void *p) throw (); struct A diff --git a/gcc/testsuite/g++.dg/compat/eh/new1_y.C b/gcc/testsuite/g++.dg/compat/eh/new1_y.C index fbe0e21..1dd373d 100644 --- a/gcc/testsuite/g++.dg/compat/eh/new1_y.C +++ b/gcc/testsuite/g++.dg/compat/eh/new1_y.C @@ -4,7 +4,10 @@ extern int ret; void *ptr; -void * operator new[] (std::size_t s) throw (std::bad_alloc) +void * operator new[] (std::size_t s) +#if __cplusplus < 201103L +throw (std::bad_alloc) +#endif { ptr = operator new (s); return ptr; diff --git a/gcc/testsuite/g++.dg/compat/eh/spec3_x.C b/gcc/testsuite/g++.dg/compat/eh/spec3_x.C index b8e5fbe..4c2aefd 100644 --- a/gcc/testsuite/g++.dg/compat/eh/spec3_x.C +++ b/gcc/testsuite/g++.dg/compat/eh/spec3_x.C @@ -1,6 +1,10 @@ #include "spec3.h" -extern void func () throw (B,A); +extern void func () +#if __cplusplus < 201103L +throw (B,A) +#endif +; void spec3_x (void) { diff --git a/gcc/testsuite/g++.dg/compat/eh/spec3_y.C b/gcc/testsuite/g++.dg/compat/eh/spec3_y.C index fef6b36..78b0914 100644 --- a/gcc/testsuite/g++.dg/compat/eh/spec3_y.C +++ b/gcc/testsuite/g++.dg/compat/eh/spec3_y.C @@ -2,7 +2,10 @@ A::A() {} -void func() throw (B,A) +void func() +#if __cplusplus < 201103L +throw (B,A) +#endif { throw A(); } diff --git a/gcc/testsuite/g++.dg/compat/eh/template1.h b/gcc/testsuite/g++.dg/compat/eh/template1.h index 93999a1..c807b47 100644 --- a/gcc/testsuite/g++.dg/compat/eh/template1.h +++ b/gcc/testsuite/g++.dg/compat/eh/template1.h @@ -11,5 +11,9 @@ struct C { typedef B<T> D; typedef typename D::E E; - void f() throw(E); + void f() +#if __cplusplus < 201103L + throw(E) +#endif + ; }; diff --git a/gcc/testsuite/g++.dg/compat/eh/template1_y.C b/gcc/testsuite/g++.dg/compat/eh/template1_y.C index 1942537..39559d9 100644 --- a/gcc/testsuite/g++.dg/compat/eh/template1_y.C +++ b/gcc/testsuite/g++.dg/compat/eh/template1_y.C @@ -1,6 +1,9 @@ #include "template1.h" -template<class T> void C<T>::f (void) throw (E) +template<class T> void C<T>::f (void) +#if __cplusplus < 201103L +throw (E) +#endif { throw E(); } diff --git a/gcc/testsuite/g++.dg/compat/eh/unexpected1_x.C b/gcc/testsuite/g++.dg/compat/eh/unexpected1_x.C index 61361a6..e8f87f1 100644 --- a/gcc/testsuite/g++.dg/compat/eh/unexpected1_x.C +++ b/gcc/testsuite/g++.dg/compat/eh/unexpected1_x.C @@ -1,3 +1,5 @@ +// { dg-options "-std=c++98" } + #include <exception> struct One { }; diff --git a/gcc/testsuite/g++.dg/compat/eh/unexpected1_y.C b/gcc/testsuite/g++.dg/compat/eh/unexpected1_y.C index 0c42c45..182b956 100644 --- a/gcc/testsuite/g++.dg/compat/eh/unexpected1_y.C +++ b/gcc/testsuite/g++.dg/compat/eh/unexpected1_y.C @@ -1,3 +1,5 @@ +// { dg-options "-std=c++98" } + struct One { }; struct Two { }; diff --git a/gcc/testsuite/g++.dg/cpp0x/auto9.C b/gcc/testsuite/g++.dg/cpp0x/auto9.C index 771ce0e..d71e55f 100644 --- a/gcc/testsuite/g++.dg/cpp0x/auto9.C +++ b/gcc/testsuite/g++.dg/cpp0x/auto9.C @@ -103,13 +103,13 @@ auto fnlate2 () -> auto *; // { dg-error "invalid use of|expected" "" { target void badthrow () throw (auto) // { dg-error "invalid use of" } -{ -} +{ // { dg-error "dynamic exception specification" "" { target c++1z } .-1 } +} // { dg-warning "deprecated" "" { target { ! c++1z } } .-2 } void badthrow2 () throw (auto &) // { dg-error "invalid use of|expected" } -{ -} +{ // { dg-error "dynamic exception specification" "" { target c++1z } .-1 } +} // { dg-warning "deprecated" "" { target { ! c++1z } } .-2 } template <auto V = 4> struct G {}; // { dg-error "auto" "" { target { ! c++1z } } } diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted23.C b/gcc/testsuite/g++.dg/cpp0x/defaulted23.C index 9e6cbc3..4d41887 100644 --- a/gcc/testsuite/g++.dg/cpp0x/defaulted23.C +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted23.C @@ -10,22 +10,22 @@ A a; struct B { - B() throw (int) = default; // { dg-message "exception-specification" } -}; - -B b; // { dg-error "deleted" } + B() throw (int) = default; // { dg-message "exception-specification" "" { target { ! c++1z } } } +}; // { dg-error "dynamic exception specification" "" { target c++1z } .-1 } + // { dg-warning "deprecated" "" { target { ! c++1z } } .-2 } +B b; // { dg-error "deleted" "" { target { ! c++1z } } } struct C { - C() throw (int) { } -}; + C() throw (int) { } // { dg-error "dynamic exception specification" "" { target c++1z } } +}; // { dg-warning "deprecated" "" { target { ! c++1z } } .-1 } C c; struct D: C { - D() throw (int) = default; -}; + D() throw (int) = default; // { dg-error "dynamic exception specification" "" { target c++1z } } +}; // { dg-warning "deprecated" "" { target { ! c++1z } } .-1 } D d; diff --git a/gcc/testsuite/g++.dg/cpp0x/error5.C b/gcc/testsuite/g++.dg/cpp0x/error5.C index e46c46d..99fb8e0 100644 --- a/gcc/testsuite/g++.dg/cpp0x/error5.C +++ b/gcc/testsuite/g++.dg/cpp0x/error5.C @@ -39,7 +39,11 @@ namespace std struct bad_alloc { }; } -void* operator new(std::size_t) throw (std::bad_alloc); +void* operator new(std::size_t) +#if __cplusplus <= 201402L +throw (std::bad_alloc) // { dg-warning "deprecated" "" { target { ! c++1z } } } +#endif +; namespace std { diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh2.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh2.C index 1ef510a..330cf95 100644 --- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh2.C +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh2.C @@ -1,7 +1,7 @@ // PR c++/47263 // PR c++/49260 // { dg-options "-fno-asynchronous-unwind-tables -fno-dwarf2-cfi-asm" } -// { dg-do run { target c++11 } } +// { dg-do run { target { c++11 && { ! c++1z } } } } #include <exception> @@ -10,7 +10,7 @@ int main( void ) std::set_unexpected( []{ throw 0; } ); try { - []() throw( int ) { throw nullptr; }(); + []() throw( int ) { throw nullptr; }(); // { dg-warning "deprecated" } } catch( int ) { } diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept02.C b/gcc/testsuite/g++.dg/cpp0x/noexcept02.C index 14bb282..7719541 100644 --- a/gcc/testsuite/g++.dg/cpp0x/noexcept02.C +++ b/gcc/testsuite/g++.dg/cpp0x/noexcept02.C @@ -10,8 +10,10 @@ void f(); SA(!noexcept(f())); -void g() throw (int); // { dg-message "previous declaration" } -void g() noexcept(false); // { dg-error "different exception" } +void g() throw (int); // { dg-message "previous declaration" "" { target { ! c++1z } } } + // { dg-error "dynamic exception specification" "" { target c++1z } .-1 } + // { dg-warning "deprecated" "" { target { ! c++1z } } .-2 } +void g() noexcept(false); // { dg-error "different exception" "" { target { ! c++1z } } } void g(); void h() throw(); diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept07.C b/gcc/testsuite/g++.dg/cpp0x/noexcept07.C index 90c50a9..de16e01 100644 --- a/gcc/testsuite/g++.dg/cpp0x/noexcept07.C +++ b/gcc/testsuite/g++.dg/cpp0x/noexcept07.C @@ -1,6 +1,6 @@ // Test that checking of a nothrow specification uses the one on the -// definition. -// { dg-do run { target c++11 } } +// definition. In C++17 throw() is equivalent to noexcept(true). +// { dg-do run { target { c++11 && c++14_down } } } #include <exception> #include <cstdlib> diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept08.C b/gcc/testsuite/g++.dg/cpp0x/noexcept08.C index 96af0fe..5a554b7 100644 --- a/gcc/testsuite/g++.dg/cpp0x/noexcept08.C +++ b/gcc/testsuite/g++.dg/cpp0x/noexcept08.C @@ -7,8 +7,8 @@ struct A virtual void g() throw(); virtual void h() noexcept; virtual void i() noexcept(false); - virtual void j() throw(int); -}; + virtual void j() throw(int); // { dg-error "dynamic exception specification" "" { target c++1z } } +}; // { dg-warning "deprecated" "" { target { ! c++1z } } .-1 } struct B: A { @@ -34,16 +34,23 @@ struct D: A void g() noexcept(false); // { dg-error "looser" } void h() noexcept(false); // { dg-error "looser" } void i() noexcept(false); - void j() noexcept(false); // { dg-error "looser" } + void j() noexcept(false); // { dg-error "looser" "" { target { ! c++1z } } } }; struct E: A { - void f() throw(int); + void f() throw(int); // { dg-error "dynamic exception specification" "" { target c++1z } } + // { dg-warning "deprecated" "" { target { ! c++1z } } .-1 } void g() throw(int); // { dg-error "looser" } + // { dg-error "dynamic exception specification" "" { target c++1z } .-1 } + // { dg-warning "deprecated" "" { target { ! c++1z } } .-2 } void h() throw(int); // { dg-error "looser" } - void i() throw(int); - void j() throw(int); + // { dg-error "dynamic exception specification" "" { target c++1z } .-1 } + // { dg-warning "deprecated" "" { target { ! c++1z } } .-2 } + void i() throw(int); // { dg-error "dynamic exception specification" "" { target c++1z } } + // { dg-warning "deprecated" "" { target { ! c++1z } } .-1 } + void j() throw(int); // { dg-error "dynamic exception specification" "" { target c++1z } } + // { dg-warning "deprecated" "" { target { ! c++1z } } .-1 } }; struct F: A @@ -52,5 +59,5 @@ struct F: A void g(); // { dg-error "looser" } void h(); // { dg-error "looser" } void i(); - void j(); // { dg-error "looser" } + void j(); // { dg-error "looser" "" { target { ! c++1z } } } }; diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept19.C b/gcc/testsuite/g++.dg/cpp0x/noexcept19.C index d303a8c..8ec4d7d 100644 --- a/gcc/testsuite/g++.dg/cpp0x/noexcept19.C +++ b/gcc/testsuite/g++.dg/cpp0x/noexcept19.C @@ -22,7 +22,11 @@ struct C struct D { - D () throw (int); + D () +#if __cplusplus <= 201402L + throw (int) // { dg-warning "deprecated" "" { target { ! c++1z } } } +#endif + ; }; C <D, B <D>> c; diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-throw.C b/gcc/testsuite/g++.dg/cpp0x/variadic-throw.C index fc81e9d..368a67b 100644 --- a/gcc/testsuite/g++.dg/cpp0x/variadic-throw.C +++ b/gcc/testsuite/g++.dg/cpp0x/variadic-throw.C @@ -9,9 +9,9 @@ template<int M, int N> struct pair template<int... M> struct S { - template<int... N> static int foo() throw (pair <M, N>...) // { dg-error "mismatched" } - { - return 1; + template<int... N> static int foo() throw (pair <M, N>...) // { dg-error "mismatched" "" { target { ! c++1z } } } + { // { dg-error "dynamic exception specification" "" { target c++1z } .-1 } + return 1; // { dg-warning "deprecated" "" { target { ! c++1z } } .-2 } } }; @@ -22,5 +22,5 @@ int bar () int wibble() { - return S<0, 1, 2>::foo<0, 1> (); // { dg-error "no matching" } + return S<0, 1, 2>::foo<0, 1> (); // { dg-error "no matching" "" { target { ! c++1z } } } } diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic73.C b/gcc/testsuite/g++.dg/cpp0x/variadic73.C index 533ed46..be998d2 100644 --- a/gcc/testsuite/g++.dg/cpp0x/variadic73.C +++ b/gcc/testsuite/g++.dg/cpp0x/variadic73.C @@ -3,7 +3,11 @@ struct A {}; struct B {}; struct C {}; -template<typename... Exceptions> void f(int idx) throw(Exceptions...) { +template<typename... Exceptions> void f(int idx) +#if __cplusplus <= 201402L +throw(Exceptions...) // { dg-warning "deprecated" "" { target { ! c++1z } } } +#endif +{ if (idx == 0) throw A(); else if (idx == 1) throw B(); else if (idx == 2) throw C(); diff --git a/gcc/testsuite/g++.dg/cpp1z/noexcept-type1.C b/gcc/testsuite/g++.dg/cpp1z/noexcept-type1.C index 62e1322..dfe64e5 100644 --- a/gcc/testsuite/g++.dg/cpp1z/noexcept-type1.C +++ b/gcc/testsuite/g++.dg/cpp1z/noexcept-type1.C @@ -1,7 +1,7 @@ // Testcase from P0012r1 // { dg-options -std=c++1z } -void (*p)() throw(int); +void (*p)() throw(int); // { dg-error "dynamic exception specification" } void (**pp)() noexcept = &p; // { dg-error "" } cannot convert to pointer to noexcept function struct S { typedef void (*p)(); operator p(); }; diff --git a/gcc/testsuite/g++.dg/eh/async-unwind2.C b/gcc/testsuite/g++.dg/eh/async-unwind2.C index 0c31f80..0f84901 100644 --- a/gcc/testsuite/g++.dg/eh/async-unwind2.C +++ b/gcc/testsuite/g++.dg/eh/async-unwind2.C @@ -87,8 +87,16 @@ struct Y struct Z; -X <V> baz1 (const S &) throw (E); -X <Z> baz2 (const X <Z> &) throw (E); +X <V> baz1 (const S &) +#if __cplusplus <= 201402L +throw (E) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif +; +X <Z> baz2 (const X <Z> &) +#if __cplusplus <= 201402L +throw (E) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif +; template <typename T> X<T>::X () { @@ -112,7 +120,10 @@ template <typename T> T *X<T>::operator -> () const return &y; } -X <V> baz1 (const S &) throw (E) +X <V> baz1 (const S &) +#if __cplusplus <= 201402L +throw (E) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { return X<V> (); } @@ -125,7 +136,10 @@ E::~E () { } -X <Z> baz2 (const X <Z> &) throw (E) +X <Z> baz2 (const X <Z> &) +#if __cplusplus <= 201402L +throw (E) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { throw E (); } diff --git a/gcc/testsuite/g++.dg/eh/cond4.C b/gcc/testsuite/g++.dg/eh/cond4.C index 4d312e4..17e9149 100644 --- a/gcc/testsuite/g++.dg/eh/cond4.C +++ b/gcc/testsuite/g++.dg/eh/cond4.C @@ -12,7 +12,13 @@ void my_terminate () struct A { A(int) { } - ~A() throw(int) { throw 1; }; + ~A() +#if __cplusplus <= 201402L + throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#else + noexcept(false) +#endif + { throw 1; }; }; struct B { B(A) { } diff --git a/gcc/testsuite/g++.dg/eh/delete1.C b/gcc/testsuite/g++.dg/eh/delete1.C index 64ccb50..46b5307 100644 --- a/gcc/testsuite/g++.dg/eh/delete1.C +++ b/gcc/testsuite/g++.dg/eh/delete1.C @@ -12,7 +12,13 @@ void operator delete (void *) throw () } struct Foo { - ~Foo() throw(int) {throw 1;} + ~Foo() +#if __cplusplus <= 201402L + throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#else + noexcept(false) +#endif + {throw 1;} }; struct Baz { @@ -20,7 +26,13 @@ struct Baz { { deleted = 2; } - virtual ~Baz() throw(int) {throw 1;} + virtual ~Baz() +#if __cplusplus <= 201402L + throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#else + noexcept(false) +#endif + {throw 1;} }; int non_virt () diff --git a/gcc/testsuite/g++.dg/eh/ehopt1.C b/gcc/testsuite/g++.dg/eh/ehopt1.C index b2fb412..852d324 100644 --- a/gcc/testsuite/g++.dg/eh/ehopt1.C +++ b/gcc/testsuite/g++.dg/eh/ehopt1.C @@ -15,7 +15,13 @@ class A<int, int> public: A(int) { ++count; if (b) throw 1; } A(const A&) { ++count; if (b) throw 1; } - ~A() throw(int) { --count; if (b) throw 1; } + ~A() +#if __cplusplus <= 201402L + throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#else + noexcept(false) +#endif + { --count; if (b) throw 1; } }; typedef A<int, int> B; @@ -26,7 +32,13 @@ class A<void *, void *> public: A() { if (b) throw 1; } A(const B&) { if (b) throw 1; } - ~A() throw(int) { if (b) throw 1; } + ~A() +#if __cplusplus <= 201402L + throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#else + noexcept(false) +#endif + { if (b) throw 1; } }; typedef A<void *, void *> C; diff --git a/gcc/testsuite/g++.dg/eh/forced3.C b/gcc/testsuite/g++.dg/eh/forced3.C index b8f47df..9e92daf 100644 --- a/gcc/testsuite/g++.dg/eh/forced3.C +++ b/gcc/testsuite/g++.dg/eh/forced3.C @@ -1,5 +1,6 @@ // HP-UX libunwind.so doesn't provide _UA_END_OF_STACK. // { dg-do run { xfail "ia64-hp-hpux11.*" } } +// { dg-require-effective-target c++14_down } // Test that forced unwinding calls std::unexpected going // through a nothrow function. diff --git a/gcc/testsuite/g++.dg/eh/forced4.C b/gcc/testsuite/g++.dg/eh/forced4.C index 17fd94a..96408d2 100644 --- a/gcc/testsuite/g++.dg/eh/forced4.C +++ b/gcc/testsuite/g++.dg/eh/forced4.C @@ -38,7 +38,10 @@ force_unwind () } static void -doit () throw(int) +doit () +#if __cplusplus <= 201402L +throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { force_unwind (); } diff --git a/gcc/testsuite/g++.dg/eh/init-temp2.C b/gcc/testsuite/g++.dg/eh/init-temp2.C index 9cf8797..127883a 100644 --- a/gcc/testsuite/g++.dg/eh/init-temp2.C +++ b/gcc/testsuite/g++.dg/eh/init-temp2.C @@ -8,18 +8,36 @@ template <class _Tp> class AutoPtr public: explicit AutoPtr(_Tp* __p = 0) : _M_ptr(__p) {} - ~AutoPtr() throw(int) { delete _M_ptr; } + ~AutoPtr() +#if __cplusplus <= 201402L + throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#else + noexcept(false) +#endif + { delete _M_ptr; } }; struct A { A() { } - ~A() throw(int) { throw 1; } + ~A() +#if __cplusplus <= 201402L + throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#else + noexcept(false) +#endif + { throw 1; } }; struct B { - virtual ~B() throw(int); + virtual ~B() +#if __cplusplus <= 201402L + throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#else + noexcept(false) +#endif + ; }; B* f (const A &s) { throw 1; } diff --git a/gcc/testsuite/g++.dg/eh/pr38662.C b/gcc/testsuite/g++.dg/eh/pr38662.C index 294a129..be3adbbd9 100644 --- a/gcc/testsuite/g++.dg/eh/pr38662.C +++ b/gcc/testsuite/g++.dg/eh/pr38662.C @@ -2,7 +2,11 @@ class E { }; class T { - int foo(bool a) throw (E) __attribute__((regparm(1))); + int foo(bool a) +#if __cplusplus <= 201402L + throw (E) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + __attribute__((regparm(1))); int bar(bool b) __attribute__((regparm(1))); }; diff --git a/gcc/testsuite/g++.dg/eh/pr41819.C b/gcc/testsuite/g++.dg/eh/pr41819.C index 07894a2..61c6572 100644 --- a/gcc/testsuite/g++.dg/eh/pr41819.C +++ b/gcc/testsuite/g++.dg/eh/pr41819.C @@ -15,7 +15,10 @@ void f1() try {} catch (...) {} // { dg-error "" } } -void f2() throw(int) +void f2() +#if __cplusplus <= 201402L +throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { bar(); } diff --git a/gcc/testsuite/g++.dg/eh/shadow1.C b/gcc/testsuite/g++.dg/eh/shadow1.C index 15f666a..b96f65a 100644 --- a/gcc/testsuite/g++.dg/eh/shadow1.C +++ b/gcc/testsuite/g++.dg/eh/shadow1.C @@ -13,14 +13,14 @@ struct D : private B friend class E; static B *baz (D *); - virtual void V () throw (B); // { dg-error "overriding" "" } -}; - + virtual void V () throw (B); // { dg-error "overriding" "" { target { ! c++1z } } } +}; // { dg-error "dynamic exception specification" "" { target c++1z } .-1 } + // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } .-2 } struct E : public D { - virtual void V () throw (D); // { dg-error "looser throw" "" } -}; - + virtual void V () throw (D); // { dg-error "looser throw" "" { target { ! c++1z } } } +}; // { dg-error "dynamic exception specification" "" { target c++1z } .-1 } + // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } .-2 } B* foo (D *); B *D::baz (D *p) diff --git a/gcc/testsuite/g++.dg/eh/spec2.C b/gcc/testsuite/g++.dg/eh/spec2.C index 8107f01..0f51264 100644 --- a/gcc/testsuite/g++.dg/eh/spec2.C +++ b/gcc/testsuite/g++.dg/eh/spec2.C @@ -3,8 +3,15 @@ struct S { void f (void); }; typedef void f1 (void) throw (int); // { dg-error "exception" "" { target c++14_down } } + // { dg-error "dynamic exception specification" "" { target c++1z } .-1 } + // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } .-2 } typedef void (*f2) (void) throw (int); // { dg-error "exception" "" { target c++14_down } } + // { dg-error "dynamic exception specification" "" { target c++1z } .-1 } + // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } .-2 } typedef void (S::*f3) (void) throw (int); // { dg-error "exception" "" { target c++14_down } } - -void (*f4) (void) throw (int); -void (S::*f5) (void) throw (int); + // { dg-error "dynamic exception specification" "" { target c++1z } .-1 } + // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } .-2 } +void (*f4) (void) throw (int); // { dg-error "dynamic exception specification" "" { target c++1z } } + // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } .-1 } +void (S::*f5) (void) throw (int); // { dg-error "dynamic exception specification" "" { target c++1z } } + // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } .-1 } diff --git a/gcc/testsuite/g++.dg/eh/spec3.C b/gcc/testsuite/g++.dg/eh/spec3.C index 20bcfc3..49bbdc3 100644 --- a/gcc/testsuite/g++.dg/eh/spec3.C +++ b/gcc/testsuite/g++.dg/eh/spec3.C @@ -12,7 +12,10 @@ struct A : virtual public Base struct B {}; -void func() throw (B,A) +void func() +#if __cplusplus <= 201402L +throw (B,A) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { throw A(); } diff --git a/gcc/testsuite/g++.dg/eh/spec5.C b/gcc/testsuite/g++.dg/eh/spec5.C index be8f327..5735e8d 100644 --- a/gcc/testsuite/g++.dg/eh/spec5.C +++ b/gcc/testsuite/g++.dg/eh/spec5.C @@ -8,12 +8,20 @@ struct A; struct B { - void f () throw (A); + void f () +#if __cplusplus <= 201402L + throw (A) +#endif + ; }; struct A {}; -void B::f () throw (A) {} +void B::f () +#if __cplusplus <= 201402L +throw (A) +#endif +{} int main () { diff --git a/gcc/testsuite/g++.dg/eh/spec6.C b/gcc/testsuite/g++.dg/eh/spec6.C index d6d8176..d08bd86 100644 --- a/gcc/testsuite/g++.dg/eh/spec6.C +++ b/gcc/testsuite/g++.dg/eh/spec6.C @@ -1,6 +1,7 @@ // Test that we don't allow incomplete types in an exception-specification // for a definition, or at a call site. +// { dg-do compile { target c++14_down } } // { dg-options "-fpermissive -w" } struct A; // { dg-message "" } diff --git a/gcc/testsuite/g++.dg/eh/spec7.C b/gcc/testsuite/g++.dg/eh/spec7.C index 08586a2..37efedc 100644 --- a/gcc/testsuite/g++.dg/eh/spec7.C +++ b/gcc/testsuite/g++.dg/eh/spec7.C @@ -19,7 +19,11 @@ struct D : public B { } o; struct Raiser { - Raiser() throw( int ) {throw 1;}; + Raiser() +#if __cplusplus <= 201402L + throw( int ) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + {throw 1;}; } raiser; }; }; diff --git a/gcc/testsuite/g++.dg/eh/spec8.C b/gcc/testsuite/g++.dg/eh/spec8.C index c76032e..8967e8c 100644 --- a/gcc/testsuite/g++.dg/eh/spec8.C +++ b/gcc/testsuite/g++.dg/eh/spec8.C @@ -1,8 +1,10 @@ // PR c++/24817 +// { dg-do compile { target c++14_down } } struct exception {}; template <typename T> void foo() throw(exception); // { dg-message "declaration" } + // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } .-1 } template <typename T> void foo(); // { dg-error "exception" } struct bar diff --git a/gcc/testsuite/g++.dg/eh/spec9.C b/gcc/testsuite/g++.dg/eh/spec9.C index 9e00d1c..cceb98f 100644 --- a/gcc/testsuite/g++.dg/eh/spec9.C +++ b/gcc/testsuite/g++.dg/eh/spec9.C @@ -4,7 +4,10 @@ typedef int IntArray[10]; IntArray i; -void test_array() throw (IntArray) +void test_array() +#if __cplusplus <= 201402L +throw (IntArray) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { throw i; } diff --git a/gcc/testsuite/g++.dg/eh/template1.C b/gcc/testsuite/g++.dg/eh/template1.C index 2cbf9c6..fb471b2 100644 --- a/gcc/testsuite/g++.dg/eh/template1.C +++ b/gcc/testsuite/g++.dg/eh/template1.C @@ -17,7 +17,11 @@ struct C { typedef B<T> D; typedef typename D::E E; - void f() throw(E) { throw E(); } + void f() +#if __cplusplus <= 201402L + throw(E) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + { throw E(); } }; int main() diff --git a/gcc/testsuite/g++.dg/eh/unexpected1.C b/gcc/testsuite/g++.dg/eh/unexpected1.C index e5982ff..cd5585f 100644 --- a/gcc/testsuite/g++.dg/eh/unexpected1.C +++ b/gcc/testsuite/g++.dg/eh/unexpected1.C @@ -1,6 +1,6 @@ // PR 3719 // Test that an unexpected handler can rethrow to categorize. -// { dg-do run } +// { dg-do run { target c++14_down } } #include <exception> @@ -23,7 +23,7 @@ handle_unexpected () } static void -doit () throw (Two) +doit () throw (Two) // { dg-warning "deprecated" "" { target { c++11 } } } { throw One (); } diff --git a/gcc/testsuite/g++.dg/ext/has_nothrow_assign.C b/gcc/testsuite/g++.dg/ext/has_nothrow_assign.C index e6e9fc6..d84a81c 100644 --- a/gcc/testsuite/g++.dg/ext/has_nothrow_assign.C +++ b/gcc/testsuite/g++.dg/ext/has_nothrow_assign.C @@ -15,6 +15,12 @@ struct B struct C : public A { }; +#if __cplusplus > 201402L +#define THROW_INT +#else +#define THROW_INT throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + struct D { D& operator=(const D&) throw() { return *this; } @@ -22,43 +28,43 @@ struct D struct E { - E& operator=(const E&) throw(int) { return *this; } + E& operator=(const E&) THROW_INT { return *this; } }; struct E1 { - E1& operator=(const E1&) throw(int) { throw int(); return *this; } + E1& operator=(const E1&) THROW_INT { throw int(); return *this; } }; struct F { - F() throw(int) { } + F() THROW_INT { } }; struct G { - G() throw(int) { throw int(); } + G() THROW_INT { throw int(); } }; struct H { - H& operator=(H&) throw(int) { return *this; } + H& operator=(H&) THROW_INT { return *this; } }; struct H1 { - H1& operator=(H1&) throw(int) { throw int(); return *this; } + H1& operator=(H1&) THROW_INT { throw int(); return *this; } }; struct I { - I& operator=(I&) throw(int) { return *this; } + I& operator=(I&) THROW_INT { return *this; } I& operator=(const I&) throw() { return *this; } }; struct I1 { - I1& operator=(I1&) throw(int) { throw int(); return *this; } + I1& operator=(I1&) THROW_INT { throw int(); return *this; } I1& operator=(const I1&) throw() { return *this; } }; diff --git a/gcc/testsuite/g++.dg/ext/has_nothrow_constructor.C b/gcc/testsuite/g++.dg/ext/has_nothrow_constructor.C index 1f1227c..d69b312 100644 --- a/gcc/testsuite/g++.dg/ext/has_nothrow_constructor.C +++ b/gcc/testsuite/g++.dg/ext/has_nothrow_constructor.C @@ -12,6 +12,12 @@ struct B A a; }; +#if __cplusplus > 201402L +#define THROW_INT +#else +#define THROW_INT throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + struct C : public A { }; @@ -22,12 +28,12 @@ struct D struct E { - E() throw(int) { } + E() THROW_INT { } }; struct E1 { - E1() throw(int) { throw int(); } + E1() THROW_INT { throw int(); } }; struct F @@ -37,7 +43,7 @@ struct F struct G { - G(const G&) throw(int) { throw int(); } + G(const G&) THROW_INT { throw int(); } }; template<typename T> diff --git a/gcc/testsuite/g++.dg/ext/has_nothrow_copy-1.C b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-1.C index 87785ae..0e5a9de 100644 --- a/gcc/testsuite/g++.dg/ext/has_nothrow_copy-1.C +++ b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-1.C @@ -15,6 +15,12 @@ struct B struct C : public A { }; +#if __cplusplus > 201402L +#define THROW_INT +#else +#define THROW_INT throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + struct D { D(const D&) throw() { } @@ -22,12 +28,12 @@ struct D struct E { - E(const E&) throw(int) { } + E(const E&) THROW_INT { } }; struct E1 { - E1(const E1&) throw(int) { throw int(); } + E1(const E1&) THROW_INT { throw int(); } }; struct F @@ -37,28 +43,28 @@ struct F struct G { - G() throw(int) { throw int(); } + G() THROW_INT { throw int(); } }; struct H { - H(H&) throw(int) { } + H(H&) THROW_INT { } }; struct H1 { - H1(H1&) throw(int) { throw int(); } + H1(H1&) THROW_INT { throw int(); } }; struct I { - I(I&) throw(int) { } + I(I&) THROW_INT { } I(const I&) throw() { } }; struct I1 { - I1(I1&) throw(int) { throw int(); } + I1(I1&) THROW_INT { throw int(); } I1(const I1&) throw() { } }; diff --git a/gcc/testsuite/g++.dg/ext/has_nothrow_copy-2.C b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-2.C index b2eb203..f15c417 100644 --- a/gcc/testsuite/g++.dg/ext/has_nothrow_copy-2.C +++ b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-2.C @@ -2,8 +2,21 @@ // { dg-do run } #include <cassert> -struct A { template <class T> A (T) throw (int); }; -struct B { B (B&) throw (); template <class T> B (T) throw (int); }; +struct A { + template <class T> A (T) +#if __cplusplus <= 201402L + throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + ; +}; +struct B { + B (B&) throw (); + template <class T> B (T) +#if __cplusplus <= 201402L + throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + ; +}; int main () { diff --git a/gcc/testsuite/g++.dg/ext/has_nothrow_copy-4.C b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-4.C index 69e9a6b..4c63b96 100644 --- a/gcc/testsuite/g++.dg/ext/has_nothrow_copy-4.C +++ b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-4.C @@ -4,7 +4,11 @@ struct S { S (const S&) throw (); - S (...) throw (int); + S (...) +#if __cplusplus <= 201402L + throw (int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + ; }; int main () diff --git a/gcc/testsuite/g++.dg/ext/has_nothrow_copy-5.C b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-5.C index b94b338..768c9af 100644 --- a/gcc/testsuite/g++.dg/ext/has_nothrow_copy-5.C +++ b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-5.C @@ -4,7 +4,11 @@ struct S { S (const S&) throw (); - S (int) throw (int); + S (int) +#if __cplusplus <= 201402L + throw (int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + ; }; int main () diff --git a/gcc/testsuite/g++.dg/ext/has_nothrow_copy-6.C b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-6.C index 6268ee2..27f4c0a 100644 --- a/gcc/testsuite/g++.dg/ext/has_nothrow_copy-6.C +++ b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-6.C @@ -3,7 +3,11 @@ struct S { S (S&) throw (); - S (const S&, int) throw (int); + S (const S&, int) +#if __cplusplus <= 201402L + throw (int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + ; }; int main () diff --git a/gcc/testsuite/g++.dg/ext/has_nothrow_copy-7.C b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-7.C index 10891b6..ac2dd8c 100644 --- a/gcc/testsuite/g++.dg/ext/has_nothrow_copy-7.C +++ b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-7.C @@ -3,7 +3,11 @@ struct S { S (const S&) throw (); - S (S&&) throw (int); + S (S&&) +#if __cplusplus <= 201402L + throw (int) // { dg-warning "deprecated" "" { target { ! c++1z } } } +#endif + ; }; int main () diff --git a/gcc/testsuite/g++.dg/gcov/gcov-7.C b/gcc/testsuite/g++.dg/gcov/gcov-7.C index db3e95a..bbc0f10 100644 --- a/gcc/testsuite/g++.dg/gcov/gcov-7.C +++ b/gcc/testsuite/g++.dg/gcov/gcov-7.C @@ -7,7 +7,10 @@ struct foo { - foo () throw (int) + foo () +#if __cplusplus <= 201402L + throw (int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { /* count (-) */ throw (1); } diff --git a/gcc/testsuite/g++.dg/init/new13.C b/gcc/testsuite/g++.dg/init/new13.C index 2ced6e3..832942e 100644 --- a/gcc/testsuite/g++.dg/init/new13.C +++ b/gcc/testsuite/g++.dg/init/new13.C @@ -6,6 +6,6 @@ struct A { void* operator new(__SIZE_TYPE__) throw(X); // { dg-error "expected|type" } -}; - +}; // { dg-error "dynamic exception specification" "" { target c++1z } .-1 } + // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } .-2 } A* p = new A; diff --git a/gcc/testsuite/g++.dg/init/new25.C b/gcc/testsuite/g++.dg/init/new25.C index 2d447f8..754ac92 100644 --- a/gcc/testsuite/g++.dg/init/new25.C +++ b/gcc/testsuite/g++.dg/init/new25.C @@ -5,7 +5,11 @@ class C { public: void* operator new(std::size_t = 32) throw (std::bad_alloc); // { dg-error "first parameter" } + // { dg-error "dynamic exception specification" "" { target c++1z } .-1 } + // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } .-2 } void* operator new[](std::size_t = 32) throw (std::bad_alloc); // { dg-error "first parameter" } + // { dg-error "dynamic exception specification" "" { target c++1z } .-1 } + // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } .-2 } void* operator new(std::size_t = 32, const std::nothrow_t&) throw(); // { dg-error "first parameter" } void* operator new[](std::size_t = 32, const std::nothrow_t&) throw(); // { dg-error "first parameter" } }; diff --git a/gcc/testsuite/g++.dg/lookup/exception1.C b/gcc/testsuite/g++.dg/lookup/exception1.C index b5fcd0a..00ef817 100644 --- a/gcc/testsuite/g++.dg/lookup/exception1.C +++ b/gcc/testsuite/g++.dg/lookup/exception1.C @@ -11,8 +11,16 @@ namespace ns { class Test { public: - inline Test() throw( Exception ); - inline Test(int n ) throw( Exception ); + inline Test() +#if __cplusplus <= 201402L + throw( Exception ) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + ; + inline Test(int n ) +#if __cplusplus <= 201402L + throw( Exception ) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + ; private: int i; }; @@ -20,11 +28,19 @@ namespace ns // This line used to fail because Exception wasn't looked up in the // right scope. -ns::Test::Test() throw( Exception ) : i( 1 ) +ns::Test::Test() +#if __cplusplus <= 201402L +throw( Exception ) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif +: i( 1 ) { } -ns::Test::Test( int n ) throw( Exception ) : i( n ) +ns::Test::Test( int n ) +#if __cplusplus <= 201402L +throw( Exception ) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif +: i( n ) { } diff --git a/gcc/testsuite/g++.dg/opt/noreturn-1.C b/gcc/testsuite/g++.dg/opt/noreturn-1.C index 9b2fc0c..8fe2db0 100644 --- a/gcc/testsuite/g++.dg/opt/noreturn-1.C +++ b/gcc/testsuite/g++.dg/opt/noreturn-1.C @@ -58,16 +58,34 @@ struct Egeneric { }; struct infinint { - void detruit() throw(Egeneric); - template<class T> void infinint_from(T a) throw(Egeneric); - infinint(long a = 0) throw(Egeneric) { + void detruit() +#if __cplusplus <= 201402L + throw(Egeneric) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + ; + template<class T> void infinint_from(T a) +#if __cplusplus <= 201402L + throw(Egeneric) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + ; + infinint(long a = 0) +#if __cplusplus <= 201402L + throw(Egeneric) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + { try { infinint_from(a); } catch(Egeneric& e) { e.stack("infinint::infinint", "long"); } } - ~infinint() throw(Egeneric) { + ~infinint() +#if __cplusplus <= 201402L + throw(Egeneric) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#else + noexcept(false) +#endif + { try { detruit(); } catch(Egeneric& e) { } diff --git a/gcc/testsuite/g++.dg/other/error3.C b/gcc/testsuite/g++.dg/other/error3.C index 37ea51e..1e64563 100644 --- a/gcc/testsuite/g++.dg/other/error3.C +++ b/gcc/testsuite/g++.dg/other/error3.C @@ -1,5 +1,6 @@ // Test for proper error message formatting; the throw() should go inside // the parens, as below. -void (*g() throw())(); // { dg-message "g\\(\\) throw" "" } +void (*g() throw())(); // { dg-message "g\\(\\) throw" "" { target { ! c++1z } } } + // { dg-message "g\\(\\) noexcept" "" { target c++1z } .-1 } void (*g())(); // { dg-error "" "" } diff --git a/gcc/testsuite/g++.dg/rtti/crash3.C b/gcc/testsuite/g++.dg/rtti/crash3.C index 076e360..111d3b3 100644 --- a/gcc/testsuite/g++.dg/rtti/crash3.C +++ b/gcc/testsuite/g++.dg/rtti/crash3.C @@ -5,6 +5,9 @@ class A {}; class B {}; class C : public A, public B {}; class D : public C {}; -void f () throw (D) +void f () +#if __cplusplus <= 201402L +throw (D) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { } diff --git a/gcc/testsuite/g++.dg/template/eh2.C b/gcc/testsuite/g++.dg/template/eh2.C index 9559b4e..3ed80a4 100644 --- a/gcc/testsuite/g++.dg/template/eh2.C +++ b/gcc/testsuite/g++.dg/template/eh2.C @@ -1,10 +1,10 @@ // PR c++/23191 // Origin: Volker Reichelt <reichelt@igpm.rwth-aachen.de> -// { dg-do compile } +// { dg-do compile { target c++14_down } } template<typename T> struct A { void foo() throw(typename T::X); // { dg-error "not a class" } -}; +}; // { dg-warning "deprecated" "" { target c++11 } .-1 } A<void> a; // { dg-message "required" } diff --git a/gcc/testsuite/g++.dg/template/error36.C b/gcc/testsuite/g++.dg/template/error36.C index 8d3dc63..d808c14 100644 --- a/gcc/testsuite/g++.dg/template/error36.C +++ b/gcc/testsuite/g++.dg/template/error36.C @@ -1,9 +1,11 @@ // PR c++/37719.C +// { dg-do compile { target c++14_down } } template <typename T> class foo { void bar() throw(int); // { dg-message "throw \\(int\\)" } -}; +}; // { dg-warning "deprecated" "" { target c++11 } .-1 } template <> void foo<int>::bar() throw(float) {} // { dg-error "throw \\(float\\)" } + // { dg-warning "deprecated" "" { target c++11 } .-1 } diff --git a/gcc/testsuite/g++.dg/tm/pr46567.C b/gcc/testsuite/g++.dg/tm/pr46567.C index 2f0ef93..448c92c 100644 --- a/gcc/testsuite/g++.dg/tm/pr46567.C +++ b/gcc/testsuite/g++.dg/tm/pr46567.C @@ -1667,8 +1667,16 @@ namespace std typedef void (*new_handler)(); new_handler set_new_handler(new_handler) throw(); } -void* operator new(std::size_t) throw (std::bad_alloc); -void* operator new[](std::size_t) throw (std::bad_alloc); +void* operator new(std::size_t) +#if __cplusplus <= 201402L +throw (std::bad_alloc) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif +; +void* operator new[](std::size_t) +#if __cplusplus <= 201402L +throw (std::bad_alloc) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif +; void operator delete(void*) throw(); void operator delete[](void*) throw(); void* operator new(std::size_t, const std::nothrow_t&) throw(); diff --git a/gcc/testsuite/g++.dg/tm/pr47340.C b/gcc/testsuite/g++.dg/tm/pr47340.C index ead3361..e5075e2 100644 --- a/gcc/testsuite/g++.dg/tm/pr47340.C +++ b/gcc/testsuite/g++.dg/tm/pr47340.C @@ -1,7 +1,11 @@ // { dg-do compile } // { dg-options "-fgnu-tm" } -void* operator new(__SIZE_TYPE__) throw (int); +void* operator new(__SIZE_TYPE__) +#if __cplusplus <= 201402L +throw (int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif +; void *point; diff --git a/gcc/testsuite/g++.dg/torture/pr46364.C b/gcc/testsuite/g++.dg/torture/pr46364.C index 8098991..0160e9a 100644 --- a/gcc/testsuite/g++.dg/torture/pr46364.C +++ b/gcc/testsuite/g++.dg/torture/pr46364.C @@ -1,7 +1,11 @@ // { dg-do compile } #include <string> -void a() throw (int); +void a() +#if __cplusplus <= 201402L +throw (int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif +; void b(std::string const &); void c(std::string *e) diff --git a/gcc/testsuite/g++.dg/torture/pr49394.C b/gcc/testsuite/g++.dg/torture/pr49394.C index e471885..cd8cac3 100644 --- a/gcc/testsuite/g++.dg/torture/pr49394.C +++ b/gcc/testsuite/g++.dg/torture/pr49394.C @@ -4,7 +4,10 @@ struct Mutex { bool locked; - ~Mutex () throw(int) + ~Mutex () +#if __cplusplus <= 201402L + throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { if (locked) throw 0; diff --git a/gcc/testsuite/g++.dg/torture/pr52918-1.C b/gcc/testsuite/g++.dg/torture/pr52918-1.C index 9e7b21b..cb95048 100644 --- a/gcc/testsuite/g++.dg/torture/pr52918-1.C +++ b/gcc/testsuite/g++.dg/torture/pr52918-1.C @@ -21,9 +21,16 @@ public: class free_list { typedef __mutex __mutex_type; __mutex_type& _M_get_mutex(); - void _M_get(size_t __sz) throw(bad_alloc); + void _M_get(size_t __sz) +#if __cplusplus <= 201402L + throw(bad_alloc) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + ; }; -void free_list::_M_get(size_t __sz) throw(bad_alloc) +void free_list::_M_get(size_t __sz) +#if __cplusplus <= 201402L +throw(bad_alloc) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { __mutex_type& __bfl_mutex = _M_get_mutex(); __bfl_mutex.unlock(); diff --git a/gcc/testsuite/g++.dg/torture/pr57190.C b/gcc/testsuite/g++.dg/torture/pr57190.C index 9fa11cd..f3b7ecc 100644 --- a/gcc/testsuite/g++.dg/torture/pr57190.C +++ b/gcc/testsuite/g++.dg/torture/pr57190.C @@ -19,12 +19,24 @@ namespace std { class UIException { }; class PasswordDialog { - void run() throw (UIException); + void run() +#if __cplusplus <= 201402L + throw (UIException) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + ; }; class MessageBox { public: - MessageBox (std::string t) throw (UIException); - virtual int run() throw (UIException) ; + MessageBox (std::string t) +#if __cplusplus <= 201402L + throw (UIException) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + ; + virtual int run() +#if __cplusplus <= 201402L + throw (UIException) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + ; }; extern "C" { struct __jmp_buf_tag { @@ -33,7 +45,10 @@ extern "C" { typedef struct __jmp_buf_tag sigjmp_buf[1]; } sigjmp_buf password_dialog_sig_jmp_buf; -void PasswordDialog::run() throw (UIException) +void PasswordDialog::run() +#if __cplusplus <= 201402L +throw (UIException) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { __sigsetjmp (password_dialog_sig_jmp_buf, 1); MessageBox* errmsg = __null; diff --git a/gcc/testsuite/g++.dg/torture/stackalign/eh-alloca-1.C b/gcc/testsuite/g++.dg/torture/stackalign/eh-alloca-1.C index 89b0a6a..7c124fe 100644 --- a/gcc/testsuite/g++.dg/torture/stackalign/eh-alloca-1.C +++ b/gcc/testsuite/g++.dg/torture/stackalign/eh-alloca-1.C @@ -27,7 +27,10 @@ struct A : virtual public Base struct B {}; void -foo (int size) throw (B,A) +foo (int size) +#if __cplusplus <= 201402L +throw (B,A) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { char *p = (char*) __builtin_alloca (size + 1); aligned i; diff --git a/gcc/testsuite/g++.dg/torture/stackalign/eh-fastcall-1.C b/gcc/testsuite/g++.dg/torture/stackalign/eh-fastcall-1.C index 2c24ea3..165e7cc 100644 --- a/gcc/testsuite/g++.dg/torture/stackalign/eh-fastcall-1.C +++ b/gcc/testsuite/g++.dg/torture/stackalign/eh-fastcall-1.C @@ -21,7 +21,10 @@ struct B {}; __attribute__ ((fastcall)) void -foo (int j, int k, int m, int n, int o) throw (B,A) +foo (int j, int k, int m, int n, int o) +#if __cplusplus <= 201402L +throw (B,A) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { aligned i; diff --git a/gcc/testsuite/g++.dg/torture/stackalign/eh-global-1.C b/gcc/testsuite/g++.dg/torture/stackalign/eh-global-1.C index cc05ed0..48a59eb 100644 --- a/gcc/testsuite/g++.dg/torture/stackalign/eh-global-1.C +++ b/gcc/testsuite/g++.dg/torture/stackalign/eh-global-1.C @@ -21,7 +21,10 @@ struct A : virtual public Base struct B {}; void -foo (void) throw (B,A) +foo (void) +#if __cplusplus <= 201402L +throw (B,A) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { aligned i; diff --git a/gcc/testsuite/g++.dg/torture/stackalign/eh-inline-1.C b/gcc/testsuite/g++.dg/torture/stackalign/eh-inline-1.C index d2555f2..b8c04d9 100644 --- a/gcc/testsuite/g++.dg/torture/stackalign/eh-inline-1.C +++ b/gcc/testsuite/g++.dg/torture/stackalign/eh-inline-1.C @@ -22,7 +22,10 @@ struct B {}; static void inline __attribute__((always_inline)) -foo (void) throw (B,A) +foo (void) +#if __cplusplus <= 201402L +throw (B,A) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { aligned i; diff --git a/gcc/testsuite/g++.dg/torture/stackalign/eh-inline-2.C b/gcc/testsuite/g++.dg/torture/stackalign/eh-inline-2.C index 1cbc68c..53ff0cc 100644 --- a/gcc/testsuite/g++.dg/torture/stackalign/eh-inline-2.C +++ b/gcc/testsuite/g++.dg/torture/stackalign/eh-inline-2.C @@ -28,7 +28,10 @@ struct B {}; static void inline __attribute__((always_inline)) -foo (int size) throw (B,A) +foo (int size) +#if __cplusplus <= 201402L +throw (B,A) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { char *p = (char *) __builtin_alloca (size + 1); aligned i; diff --git a/gcc/testsuite/g++.dg/torture/stackalign/eh-thiscall-1.C b/gcc/testsuite/g++.dg/torture/stackalign/eh-thiscall-1.C index 403497a..44f562a 100644 --- a/gcc/testsuite/g++.dg/torture/stackalign/eh-thiscall-1.C +++ b/gcc/testsuite/g++.dg/torture/stackalign/eh-thiscall-1.C @@ -21,7 +21,10 @@ struct B {}; __attribute__ ((thiscall)) void -foo (int j, int k, int m, int n, int o) throw (B,A) +foo (int j, int k, int m, int n, int o) +#if __cplusplus <= 201402L +throw (B,A) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { aligned i; diff --git a/gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-1.C b/gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-1.C index b9ba81b..9c3c0f5 100644 --- a/gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-1.C +++ b/gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-1.C @@ -28,7 +28,10 @@ struct A : virtual public Base struct B {}; void -foo (const char *fmt, ...) throw (B,A) +foo (const char *fmt, ...) +#if __cplusplus <= 201402L +throw (B,A) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { va_list arg; char *p; diff --git a/gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-2.C b/gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-2.C index 5e28217..aa9b2bd 100644 --- a/gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-2.C +++ b/gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-2.C @@ -29,7 +29,10 @@ struct A : virtual public Base struct B {}; void -test (va_list arg) throw (B,A) +test (va_list arg) +#if __cplusplus <= 201402L +throw (B,A) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { char *p; aligned i; diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr45605.C b/gcc/testsuite/g++.dg/tree-ssa/pr45605.C index 4d83245..5460021 100644 --- a/gcc/testsuite/g++.dg/tree-ssa/pr45605.C +++ b/gcc/testsuite/g++.dg/tree-ssa/pr45605.C @@ -15,7 +15,11 @@ struct D : public B { } o; struct Raiser { - Raiser() throw( int ) {throw 1;}; + Raiser() +#if __cplusplus <= 201402L + throw( int ) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + {throw 1;}; } raiser; }; }; diff --git a/gcc/testsuite/g++.dg/warn/Wreturn-type-3.C b/gcc/testsuite/g++.dg/warn/Wreturn-type-3.C index f13d587..78a3851 100644 --- a/gcc/testsuite/g++.dg/warn/Wreturn-type-3.C +++ b/gcc/testsuite/g++.dg/warn/Wreturn-type-3.C @@ -3,7 +3,10 @@ struct E{}; -inline int bar() throw(E) +inline int bar() +#if __cplusplus <= 201402L +throw(E) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { return 0; } diff --git a/gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C b/gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C index f4f443b..31c7300 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C @@ -93,19 +93,28 @@ extern "C" void *realloc (void *p, size_t size) return r; } -void fn_throw() throw(int) +void fn_throw() +#if __cplusplus <= 201402L +throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { throw 1; } -void fn_rethrow() throw(int) +void fn_rethrow() +#if __cplusplus <= 201402L +throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { try{fn_throw();} catch(int a){ throw;} } -void fn_catchthrow() throw(int) +void fn_catchthrow() +#if __cplusplus <= 201402L +throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { try{fn_throw();} catch(int a){ diff --git a/gcc/testsuite/g++.old-deja/g++.eh/cleanup2.C b/gcc/testsuite/g++.old-deja/g++.eh/cleanup2.C index 9538de9..d644512 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/cleanup2.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/cleanup2.C @@ -18,11 +18,18 @@ static int thrower () struct X { - X (int) throw (int); + X (int) +#if __cplusplus <= 201402L + throw (int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + ; ~X () throw (); }; -X::X (int) throw (int) +X::X (int) +#if __cplusplus <= 201402L + throw (int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif {printf ("in ctor X %s\n", __PRETTY_FUNCTION__); bad = true;} X::~X () throw () {printf ("in dtor X %s\n", __PRETTY_FUNCTION__); bad = true;} @@ -30,10 +37,17 @@ X::~X () throw () struct X1 {}; struct Y : X { - Y() throw (int); + Y() +#if __cplusplus <= 201402L + throw (int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + ; ~Y() throw (); }; -Y::Y() throw (int) +Y::Y() +#if __cplusplus <= 201402L + throw (int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif : X(thrower ()) // throws, so X::X is never called {printf ("in ctor Y%s\n", __PRETTY_FUNCTION__); bad = true;} Y::~Y() throw () diff --git a/gcc/testsuite/g++.old-deja/g++.eh/spec1.C b/gcc/testsuite/g++.old-deja/g++.eh/spec1.C index 0ff8883..ea32045 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/spec1.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/spec1.C @@ -1,4 +1,4 @@ -// { dg-do run } +// { dg-do run { target c++14_down } } // Testing exception specifications. // Test 1: the original exception succeeds. @@ -9,7 +9,7 @@ void my_term () { exit (1); } void my_unexp () { throw 42; } void -f () throw (char, int, std::bad_exception) +f () throw (char, int, std::bad_exception) // { dg-warning "deprecated" "" { target c++11 } } { throw 'a'; } diff --git a/gcc/testsuite/g++.old-deja/g++.eh/spec2.C b/gcc/testsuite/g++.old-deja/g++.eh/spec2.C index 5c7a913..d1aa698 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/spec2.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/spec2.C @@ -1,4 +1,4 @@ -// { dg-do run } +// { dg-do run { target c++14_down } } // Testing exception specifications. // Test 2: the second throw succeeds. @@ -9,7 +9,7 @@ void my_term () { exit (1); } void my_unexp () { throw 42; } void -f () throw (int, std::bad_exception) +f () throw (int, std::bad_exception) // { dg-warning "deprecated" "" { target c++11 } } { throw 'a'; } diff --git a/gcc/testsuite/g++.old-deja/g++.eh/spec3.C b/gcc/testsuite/g++.old-deja/g++.eh/spec3.C index 6239270..1d57df3 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/spec3.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/spec3.C @@ -1,4 +1,4 @@ -// { dg-do run } +// { dg-do run { target c++14_down } } // Testing exception specifications. // Test 3: the bad_exception throw succeeds. @@ -9,7 +9,7 @@ void my_term () { exit (1); } void my_unexp () { throw 42; } void -f () throw (std::bad_exception) +f () throw (std::bad_exception) // { dg-warning "deprecated" "" { target c++11 } } { throw 'a'; } diff --git a/gcc/testsuite/g++.old-deja/g++.eh/spec4.C b/gcc/testsuite/g++.old-deja/g++.eh/spec4.C index e1f702e..e102239 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/spec4.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/spec4.C @@ -1,4 +1,4 @@ -// { dg-do run } +// { dg-do run { target c++14_down } } // Testing exception specifications. // Test 4: all throws fail, call terminate. @@ -9,7 +9,7 @@ void my_term () { exit (0); } void my_unexp () { throw 42; } void -f () throw (short) +f () throw (short) // { dg-warning "deprecated" "" { target c++11 } } { throw 'a'; } diff --git a/gcc/testsuite/g++.old-deja/g++.eh/spec6.C b/gcc/testsuite/g++.old-deja/g++.eh/spec6.C index 7aa474b..ed485e2 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/spec6.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/spec6.C @@ -1,4 +1,5 @@ -// { dg-do assemble } +// { dg-do assemble { target c++14_down } } +// { dg-additional-options "-Wno-deprecated" } // Copyright (C) 1999 Free Software Foundation, Inc. // Contributed by Nathan Sidwell 19 Jan 1999 <nathan@acm.org> diff --git a/gcc/testsuite/g++.old-deja/g++.eh/throw1.C b/gcc/testsuite/g++.old-deja/g++.eh/throw1.C index e5d234b..3c4813e 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/throw1.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/throw1.C @@ -1,6 +1,9 @@ // { dg-do assemble } -void athrow(const int & e) throw(int) +void athrow(const int & e) +#if __cplusplus <= 201402L +throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { throw e; } diff --git a/gcc/testsuite/g++.old-deja/g++.eh/throw2.C b/gcc/testsuite/g++.old-deja/g++.eh/throw2.C index 63bb029..b4296ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/throw2.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/throw2.C @@ -4,7 +4,10 @@ #define ANY int // a class with a public constructor -void athrow(const ANY & e) throw(ANY) +void athrow(const ANY & e) +#if __cplusplus <= 201402L +throw(ANY) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { throw e; // { dg-bogus "" } discarding const } diff --git a/gcc/testsuite/g++.old-deja/g++.eh/tmpl1.C b/gcc/testsuite/g++.old-deja/g++.eh/tmpl1.C index 985fcae..c64a522 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/tmpl1.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/tmpl1.C @@ -1,6 +1,9 @@ // { dg-do run } template <class T> -void f() throw (T) +void f() +#if __cplusplus <= 201402L +throw (T) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { throw 7; } diff --git a/gcc/testsuite/g++.old-deja/g++.eh/tmpl3.C b/gcc/testsuite/g++.old-deja/g++.eh/tmpl3.C index 0ddf63c..4fc869d 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/tmpl3.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/tmpl3.C @@ -3,9 +3,16 @@ // Posted by Trevor Taylor <ttaylor@powerup.com.au> template<class T> struct A { - void X() throw(T); + void X() +#if __cplusplus <= 201402L + throw(T) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + ; }; template<class T> inline void A<T>::X() -throw(T) { } +#if __cplusplus <= 201402L +throw(T) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif +{ } diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh15.C b/gcc/testsuite/g++.old-deja/g++.mike/eh15.C index 4418f16..a8690be 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/eh15.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/eh15.C @@ -1,6 +1,6 @@ -// { dg-do assemble } +// { dg-do assemble { target c++14_down } } // { dg-options "-fexceptions" } struct A { - A() throw (int); + A() throw (int); // { dg-warning "deprecated" "" { target c++11 } } }; diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh25.C b/gcc/testsuite/g++.old-deja/g++.mike/eh25.C index f3728cf..a6ffd33 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/eh25.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/eh25.C @@ -10,7 +10,13 @@ void my_terminate() { struct A { A() { } - ~A() throw(int) { + ~A() +#if __cplusplus <= 201402L + throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#else + noexcept(false) +#endif + { std::set_terminate (my_terminate); throw 1; // This throws from EH dtor, should call my_terminate } diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh33.C b/gcc/testsuite/g++.old-deja/g++.mike/eh33.C index b679991..cffb0c4 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/eh33.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/eh33.C @@ -1,4 +1,5 @@ // { dg-do run { xfail sparc64-*-elf z8k-*-* arm-*-pe } } +// { dg-require-effective-target c++14_down } // { dg-options "-fexceptions" } #include <exception> @@ -7,7 +8,7 @@ void my_unexpected() { throw 42; } -void foo() throw (int) { throw "Hi"; } +void foo() throw (int) { throw "Hi"; } // { dg-warning "deprecated" "" { target c++11 } } int main() { std::set_unexpected (my_unexpected); diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh34.C b/gcc/testsuite/g++.old-deja/g++.mike/eh34.C index 056f6b8..3218dd9 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/eh34.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/eh34.C @@ -1,4 +1,5 @@ // { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-require-effective-target c++14_down } #include <exception> #include <stdlib.h> diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh50.C b/gcc/testsuite/g++.old-deja/g++.mike/eh50.C index de21dc2..0ebaab4 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/eh50.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/eh50.C @@ -1,4 +1,5 @@ // { dg-do run { xfail sparc64-*-elf z8k-*-* arm-*-pe } } +// { dg-require-effective-target c++14_down } // { dg-options "-fexceptions" } #include <exception> @@ -7,7 +8,7 @@ void my_unexpected() { throw 42; } -template <class T> void foo(T) throw (int) { throw "Hi"; } +template <class T> void foo(T) throw (int) { throw "Hi"; } // { dg-warning "deprecated" "" { target c++11 } } main() { std::set_unexpected (my_unexpected); diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh51.C b/gcc/testsuite/g++.old-deja/g++.mike/eh51.C index 073980a..7d3cd41 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/eh51.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/eh51.C @@ -1,4 +1,5 @@ // { dg-do run { xfail sparc64-*-elf z8k-*-* arm-*-pe } } +// { dg-require-effective-target c++14_down } // { dg-options "-fexceptions" } #include <exception> @@ -7,7 +8,7 @@ void my_unexpected() { throw 42; } -template <class T> void foo(T) throw (T) { throw "Hi"; } +template <class T> void foo(T) throw (T) { throw "Hi"; } // { dg-warning "deprecated" "" { target c++11 } } main() { std::set_unexpected (my_unexpected); diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh55.C b/gcc/testsuite/g++.old-deja/g++.mike/eh55.C index 14826807..8b574f5 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/eh55.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/eh55.C @@ -9,7 +9,7 @@ void my_terminate_handler() { } void throw_an_unexpected_exception() throw() { - throw 1; + throw 1; // { dg-warning "throw will always call terminate" "" { target c++1z } } } int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p10416.C b/gcc/testsuite/g++.old-deja/g++.mike/p10416.C index 2d21d19..766a27b 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p10416.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p10416.C @@ -5,5 +5,9 @@ class not_ok { public: - void f() throw(int) { } + void f() +#if __cplusplus <= 201402L + throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + { } }; diff --git a/gcc/testsuite/g++.old-deja/g++.other/crash28.C b/gcc/testsuite/g++.old-deja/g++.other/crash28.C index c0f4bfa..5ff84ed 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/crash28.C +++ b/gcc/testsuite/g++.old-deja/g++.other/crash28.C @@ -27,9 +27,16 @@ class foo bool b; public: foo(); - void x () throw(bar); + void x () +#if __cplusplus <= 201402L + throw(bar) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + ; }; -void foo::x() throw(bar) +void foo::x() +#if __cplusplus <= 201402L +throw(bar) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { if (!b) throw bar (static_cast<::N::X*>(this)); // { dg-error "lambda expressions|expected|invalid" } parse error } diff --git a/gcc/testsuite/g++.old-deja/g++.other/crash30.C b/gcc/testsuite/g++.old-deja/g++.other/crash30.C index 043d54f..50ecfd9 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/crash30.C +++ b/gcc/testsuite/g++.old-deja/g++.other/crash30.C @@ -8,7 +8,7 @@ struct foo }; void foo::x() throw(bar) // { dg-error "" } parse error -{ +{ // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } .-1 } } void bar() diff --git a/gcc/testsuite/g++.old-deja/g++.other/new7.C b/gcc/testsuite/g++.old-deja/g++.other/new7.C index 0c0643e..82eabb6 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/new7.C +++ b/gcc/testsuite/g++.old-deja/g++.other/new7.C @@ -13,7 +13,10 @@ struct X { { throw 1; } - void* operator new ( std::size_t n ) throw ( std::bad_alloc ) + void* operator new ( std::size_t n ) +#if __cplusplus <= 201402L + throw ( std::bad_alloc ) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { new_flag = true; return ::operator new( n ); diff --git a/gcc/testsuite/g++.old-deja/g++.pt/ehspec1.C b/gcc/testsuite/g++.old-deja/g++.pt/ehspec1.C index e75704e..3630e1f 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/ehspec1.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/ehspec1.C @@ -1,6 +1,6 @@ -// { dg-do assemble } +// { dg-do assemble { target c++14_down } } // Bug: g++ forgets to instantiate A<int> // Contributed by Jason Merrill <jason@cygnus.com> template <class T> struct A { }; -void f () throw (A<int>); +void f () throw (A<int>); // { dg-warning "deprecated" "" { target c++11 } } diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb123.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb123.C index cb4505f..b22f4eb 100644 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb123.C +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb123.C @@ -2,7 +2,10 @@ // { dg-options "-O2 -W " } #include "stdio.h" -void writeNote() throw( int ) +void writeNote() +#if __cplusplus <= 201402L +throw( int ) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { printf( "hello world\n" ); try { } |