Another missing maybe_instantiate_noexcept. Tested x86_64-pc-linux-gnu, applying to trunk and 4.7.
commit 1a9ad88eb3e501aed25ca6542776aacf431c7adc Author: Jason Merrill <ja...@redhat.com> Date: Sat Feb 9 15:58:29 2013 -0500
PR c++/56268 * semantics.c (classtype_has_nothrow_assign_or_copy_p): Call maybe_instantiate_noexcept. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index f8b37c1..e3dea09 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -5413,6 +5413,7 @@ classtype_has_nothrow_assign_or_copy_p (tree type, bool assign_p) else if (copy_fn_p (fn) <= 0) continue; + maybe_instantiate_noexcept (fn); if (!TYPE_NOTHROW_P (TREE_TYPE (fn))) return false; } diff --git a/gcc/testsuite/g++.dg/ext/has_nothrow_copy-8.C b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-8.C new file mode 100644 index 0000000..e1be1a0 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-8.C @@ -0,0 +1,19 @@ +// PR c++/56268 +// { dg-options -std=c++11 } + +template <class T> +struct A { + A(const A&) noexcept (T::value); +}; + +struct B { + static const bool value = true; +}; + +template <class T> +struct C { + static const bool value = __has_nothrow_copy (T); +}; + +#define SA(X) static_assert((X),#X) +SA(C<A<B>>::value);