diff options
| author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-10-03 16:29:07 +0000 |
|---|---|---|
| committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-10-03 16:29:07 +0000 |
| commit | 35f85a5a902238b9767145455d4751eaec8f9ea2 (patch) | |
| tree | 84895d6f0fd1e1cc6c70307db98155f13c421fae | |
| parent | 1db0fa5055672380ffdf9ea32b6ef81ba166f436 (diff) | |
| download | ppe42-gcc-35f85a5a902238b9767145455d4751eaec8f9ea2.tar.gz ppe42-gcc-35f85a5a902238b9767145455d4751eaec8f9ea2.zip | |
/cp
2008-10-03 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/37719
* error.c (dump_function_decl): Save the exceptions in case of
error about incompatible specifications in a specialization.
/testsuite
2008-10-03 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/37719
* g++.dg/template/error36.C: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@140855 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
| -rw-r--r-- | gcc/cp/error.c | 7 | ||||
| -rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
| -rw-r--r-- | gcc/testsuite/g++.dg/template/error36.C | 9 |
4 files changed, 26 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ea319f31aaa..acb766f7124 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2008-10-03 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/37719 + * error.c (dump_function_decl): Save the exceptions in case of + error about incompatible specifications in a specialization. + 2008-10-01 Andrew Pinski <andrew_pinski@playstation.sony.com> * tree.c (lvalue_p_1): COMPOUND_LITERAL_EXPR is also an lvalue. diff --git a/gcc/cp/error.c b/gcc/cp/error.c index b8330c3d0fc..4064ad400e2 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -1084,11 +1084,16 @@ dump_function_decl (tree t, int flags) tree template_parms = NULL_TREE; int show_return = flags & TFF_RETURN_TYPE || flags & TFF_DECL_SPECIFIERS; int do_outer_scope = ! (flags & TFF_UNQUALIFIED_NAME); + tree exceptions; flags &= ~TFF_UNQUALIFIED_NAME; if (TREE_CODE (t) == TEMPLATE_DECL) t = DECL_TEMPLATE_RESULT (t); + /* Save the exceptions, in case t is a specialization and we are + emitting an error about incompatible specifications. */ + exceptions = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (t)); + /* Pretty print template instantiations only. */ if (DECL_USE_TEMPLATE (t) && DECL_TEMPLATE_INFO (t)) { @@ -1153,7 +1158,7 @@ dump_function_decl (tree t, int flags) if (flags & TFF_EXCEPTION_SPECIFICATION) { pp_base (cxx_pp)->padding = pp_before; - dump_exception_spec (TYPE_RAISES_EXCEPTIONS (fntype), flags); + dump_exception_spec (exceptions, flags); } if (show_return) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7894386318c..f2c8bf235d2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-10-03 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/37719 + * g++.dg/template/error36.C: New. + 2008-10-02 Steven Bosscher <steven@gcc.gnu.org> PR fortran/37635 diff --git a/gcc/testsuite/g++.dg/template/error36.C b/gcc/testsuite/g++.dg/template/error36.C new file mode 100644 index 00000000000..b16b976e382 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/error36.C @@ -0,0 +1,9 @@ +// PR c++/37719.C + +template <typename T> +class foo { + void bar() throw(int); // { dg-error "throw \\(int\\)" } +}; + +template <> +void foo<int>::bar() throw(float) {} // { dg-error "throw \\(float\\)" } |

