From: Jason Merrill Date: Wed, 19 Feb 2014 19:03:19 +0000 (-0500) Subject: re PR c++/60046 (internal compiler error: in nothrow_spec_p, at cp/except.c:1280) X-Git-Tag: releases/gcc-4.9.0~828 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=55694175e2e6a933c98f791dda1789659a0f5350;p=thirdparty%2Fgcc.git re PR c++/60046 (internal compiler error: in nothrow_spec_p, at cp/except.c:1280) PR c++/60046 * pt.c (maybe_instantiate_noexcept): Don't instantiate exception spec from template context. From-SVN: r207917 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d1e2f479b9bb..9a2d44775f77 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2014-02-19 Jason Merrill + + PR c++/60046 + * pt.c (maybe_instantiate_noexcept): Don't instantiate exception + spec from template context. + 2014-02-19 Jakub Jelinek PR debug/56563 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index fb30af35fbf8..6477fce7aab3 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -19285,6 +19285,10 @@ maybe_instantiate_noexcept (tree fn) { tree fntype, spec, noex, clone; + /* Don't instantiate a noexcept-specification from template context. */ + if (processing_template_decl) + return; + if (DECL_CLONED_FUNCTION_P (fn)) fn = DECL_CLONED_FUNCTION (fn); fntype = TREE_TYPE (fn); diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept22.C b/gcc/testsuite/g++.dg/cpp0x/noexcept22.C new file mode 100644 index 000000000000..7aab0f43c4ea --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/noexcept22.C @@ -0,0 +1,21 @@ +// PR c++/60046 +// { dg-require-effective-target c++11 } + +constexpr bool foo () { return noexcept (true); } +template +struct V +{ + void bar (V &) noexcept (foo ()) {} +}; +template +struct W : public V +{ + void bar (W &x) { V ::bar (x); } +}; + +int +main () +{ + W a, b; + a.bar (b); +}