From: Jason Merrill Date: Wed, 19 Feb 2014 19:59:09 +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.7.4~240 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2cd91876eff2a0cb0a81a0861899dfeda0a184d0;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: r207922 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d32d4c4f380a..5798bbc85849 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-01-31 Jason Merrill PR c++/57043 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index ed33198dda2e..f2b2f9bccf93 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -18093,6 +18093,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); +}