From: Jason Merrill Date: Fri, 26 Jun 2015 21:31:08 +0000 (-0400) Subject: re PR c++/66684 (ICE in merge_exception_specifiers, at cp/typeck2.c:2114) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9579e906e237d5d6b08732331140e2c239b23ae1;p=gcc.git re PR c++/66684 (ICE in merge_exception_specifiers, at cp/typeck2.c:2114) PR c++/66684 * typeck2.c (merge_exception_specifiers): Allow different noexcept-specifiers if we've had errors. From-SVN: r225086 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e9030a7de22..5bfebe2359f 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 7597de1158a..c670879108b 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 00000000000..e3eb7dbeac6 --- /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; }