aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2014-02-19 14:03:19 -0500
committerJason Merrill <jason@gcc.gnu.org>2014-02-19 14:03:19 -0500
commit55694175e2e6a933c98f791dda1789659a0f5350 (patch)
treed736596d9a8a025098dc4310e105c51fd509dd4e
parent1c9f5f333ab764cc2e4cdde8d7da98a65a6d8498 (diff)
downloadgcc-55694175e2e6a933c98f791dda1789659a0f5350.zip
gcc-55694175e2e6a933c98f791dda1789659a0f5350.tar.gz
gcc-55694175e2e6a933c98f791dda1789659a0f5350.tar.bz2
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
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/pt.c4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/noexcept22.C21
3 files changed, 31 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index d1e2f47..9a2d447 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index fb30af3..6477fce 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 0000000..7aab0f4
--- /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 <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);
+}