diff options
author | Jason Merrill <jason@redhat.com> | 2015-06-26 17:31:08 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2015-06-26 17:31:08 -0400 |
commit | 9579e906e237d5d6b08732331140e2c239b23ae1 (patch) | |
tree | fe2219853540182866efd8b37ff2f5aa3c3b4565 /gcc | |
parent | 7498239e97b1cb7c049e0f39481af7c812f894ab (diff) | |
download | gcc-9579e906e237d5d6b08732331140e2c239b23ae1.zip gcc-9579e906e237d5d6b08732331140e2c239b23ae1.tar.gz gcc-9579e906e237d5d6b08732331140e2c239b23ae1.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/typeck2.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/noexcept28.C | 20 |
3 files changed, 25 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e9030a7..5bfebe2 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2015-06-26 Jason Merrill <jason@redhat.com> + 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 7597de1..c670879 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 0000000..e3eb7db --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/noexcept28.C @@ -0,0 +1,20 @@ +// PR c++/66684 +// { dg-do compile { target c++11 } } + +template<typename T> +struct traits +{ + static constexpr bool foo() { return sizeof(T) > 1; } + static constexpr bool bar() { return sizeof(T) > 1; } +}; + +template<typename T> +struct X +{ + X& operator=(X&&) noexcept(traits<T>::foo()); +}; + +template<typename T> + X<T>& + X<T>::operator=(X&&) noexcept(traits<T>::foo() && traits<T>::bar()) // { dg-error "different exception" } + { return *this; } |