44 lines
1.0 KiB
Diff
44 lines
1.0 KiB
Diff
2014-02-19 Jason Merrill <jason@redhat.com>
|
|
|
|
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 <typename T>
|
|
+struct V
|
|
+{
|
|
+ void bar (V &) noexcept (foo ()) {}
|
|
+};
|
|
+template <typename T>
|
|
+struct W : public V <int>
|
|
+{
|
|
+ void bar (W &x) { V <int>::bar (x); }
|
|
+};
|
|
+
|
|
+int
|
|
+main ()
|
|
+{
|
|
+ W <int> a, b;
|
|
+ a.bar (b);
|
|
+}
|