commit 24e0467a1a5c0099b24aea8c7ec81f49b88f6a2c
Author: Jason Merrill <jason@redhat.com>
Date: Fri Jun 26 16:40:56 2015 -0400
PR c++/66684
* typeck2.c (merge_exception_specifiers): Allow different
noexcept-specifiers if we've had errors.
@@ -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. */
new file mode 100644
@@ -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; }