From f755666bb9b781a6fe122def37a9f237723de00f Mon Sep 17 00:00:00 2001 From: jason Date: Fri, 26 Jun 2015 21:31:08 +0000 Subject: [PATCH] PR c++/66684 * typeck2.c (merge_exception_specifiers): Allow different noexcept-specifiers if we've had errors. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@225086 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/typeck2.c | 1 + gcc/testsuite/g++.dg/cpp0x/noexcept28.C | 20 ++++++++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/noexcept28.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e9030a7de22d..5bfebe2359f1 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2015-06-26 Jason Merrill + PR c++/66684 + * typeck2.c (merge_exception_specifiers): Allow different + noexcept-specifiers if we've had errors. + PR c++/66255 * pt.c (check_unstripped_args): Split out from... (retrieve_specialization): ...here. Allow typedefs in the type of diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 7597de1158a7..c670879108bf 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -2112,6 +2112,7 @@ merge_exception_specifiers (tree list, tree add) return add; noex = TREE_PURPOSE (list); gcc_checking_assert (!TREE_PURPOSE (add) + || errorcount || cp_tree_equal (noex, TREE_PURPOSE (add))); /* Combine the dynamic-exception-specifiers, if any. */ diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept28.C b/gcc/testsuite/g++.dg/cpp0x/noexcept28.C new file mode 100644 index 000000000000..e3eb7dbeac63 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/noexcept28.C @@ -0,0 +1,20 @@ +// PR c++/66684 +// { dg-do compile { target c++11 } } + +template +struct traits +{ + static constexpr bool foo() { return sizeof(T) > 1; } + static constexpr bool bar() { return sizeof(T) > 1; } +}; + +template +struct X +{ + X& operator=(X&&) noexcept(traits::foo()); +}; + +template + X& + X::operator=(X&&) noexcept(traits::foo() && traits::bar()) // { dg-error "different exception" } + { return *this; } -- 2.47.3