2014-02-19 Jason Merrill PR c++/60046 * pt.c (maybe_instantiate_noexcept): Don't instantiate exception spec from template context. --- gcc/cp/pt.c (revision 207920) +++ gcc/cp/pt.c (revision 207921) @@ -18567,6 +18567,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); --- gcc/testsuite/g++.dg/cpp0x/noexcept22.C (revision 0) +++ gcc/testsuite/g++.dg/cpp0x/noexcept22.C (revision 207921) @@ -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); +}