]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/60046 (internal compiler error: in nothrow_spec_p, at cp/except.c:1280)
authorJason Merrill <jason@redhat.com>
Wed, 19 Feb 2014 19:03:19 +0000 (14:03 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 19 Feb 2014 19:03:19 +0000 (14:03 -0500)
PR c++/60046
* pt.c (maybe_instantiate_noexcept): Don't instantiate exception
spec from template context.

From-SVN: r207917

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/g++.dg/cpp0x/noexcept22.C [new file with mode: 0644]

index d1e2f479b9bbcadcb8863a35f509c35c6a89f70c..9a2d44775f77da52f312c2b3c63591852ad8ceec 100644 (file)
@@ -1,3 +1,9 @@
+2014-02-19  Jason Merrill  <jason@redhat.com>
+
+       PR c++/60046
+       * pt.c (maybe_instantiate_noexcept): Don't instantiate exception
+       spec from template context.
+
 2014-02-19  Jakub Jelinek  <jakub@redhat.com>
 
        PR debug/56563
index fb30af35fbf828d75817b667fd423c94459253d5..6477fce7aab36dd15ecb176ee95d557bef8c443c 100644 (file)
@@ -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 (file)
index 0000000..7aab0f4
--- /dev/null
@@ -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);
+}