diff options
author | Jason Merrill <jason@redhat.com> | 2014-02-19 14:03:19 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2014-02-19 14:03:19 -0500 |
commit | 55694175e2e6a933c98f791dda1789659a0f5350 (patch) | |
tree | d736596d9a8a025098dc4310e105c51fd509dd4e | |
parent | 1c9f5f333ab764cc2e4cdde8d7da98a65a6d8498 (diff) | |
download | gcc-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/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/pt.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/noexcept22.C | 21 |
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); +} |