From fdc2ae49fd456418639ebfea7d34ad7beda3c093 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 25 Dec 2014 02:28:01 -0500 Subject: [PATCH] pt.c (check_default_tmpl_args): Uses the parameter source location in the diagnostic. * pt.c (check_default_tmpl_args): Uses the parameter source location in the diagnostic. (convert_template_argument): Just return if parm is error_mark_node. From-SVN: r219067 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/pt.c | 12 +++++------- gcc/testsuite/g++.dg/cpp0x/pr31432.C | 4 ++-- gcc/testsuite/g++.dg/cpp0x/pr31442.C | 2 +- gcc/testsuite/g++.dg/cpp0x/pr32115.C | 2 +- gcc/testsuite/g++.dg/cpp0x/variadic40.C | 4 ++-- gcc/testsuite/g++.dg/template/crash55.C | 2 +- gcc/testsuite/g++.dg/template/crash57.C | 2 +- 8 files changed, 17 insertions(+), 15 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4eb87127342..bd5dd495595 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2014-12-25 Jason Merrill + * pt.c (check_default_tmpl_args): Uses the parameter source + location in the diagnostic. + (convert_template_argument): Just return if parm is error_mark_node. + PR c++/63522 * parser.c (cp_parser_type_parameter): Call check_for_bare_parameter_packs on default argument. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index f5bd842df0e..21d0d3aa4e9 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -4578,13 +4578,8 @@ check_default_tmpl_args (tree decl, tree parms, bool is_primary, parameter pack, at the end of the template parameter list. */ - if (TREE_CODE (TREE_VALUE (parm)) == PARM_DECL) - error ("parameter pack %qE must be at the end of the" - " template parameter list", TREE_VALUE (parm)); - else - error ("parameter pack %qT must be at the end of the" - " template parameter list", - TREE_TYPE (TREE_VALUE (parm))); + error ("parameter pack %q+D must be at the end of the" + " template parameter list", TREE_VALUE (parm)); TREE_VALUE (TREE_VEC_ELT (inner_parms, i)) = error_mark_node; @@ -6524,6 +6519,9 @@ convert_template_argument (tree parm, tree val; int is_type, requires_type, is_tmpl_type, requires_tmpl_type; + if (parm == error_mark_node) + return error_mark_node; + if (TREE_CODE (arg) == TREE_LIST && TREE_CODE (TREE_VALUE (arg)) == OFFSET_REF) { diff --git a/gcc/testsuite/g++.dg/cpp0x/pr31432.C b/gcc/testsuite/g++.dg/cpp0x/pr31432.C index 1f2ea50972e..2048077c36a 100644 --- a/gcc/testsuite/g++.dg/cpp0x/pr31432.C +++ b/gcc/testsuite/g++.dg/cpp0x/pr31432.C @@ -4,5 +4,5 @@ template struct A // { dg-error "parameter pack" } static int i; }; -A a; // { dg-error "mismatch|expected|invalid type" } -A b; // { dg-error "mismatch|expected|invalid type" } +A a; +A b; diff --git a/gcc/testsuite/g++.dg/cpp0x/pr31442.C b/gcc/testsuite/g++.dg/cpp0x/pr31442.C index 7fd20e7ca55..b4c737c603c 100644 --- a/gcc/testsuite/g++.dg/cpp0x/pr31442.C +++ b/gcc/testsuite/g++.dg/cpp0x/pr31442.C @@ -6,4 +6,4 @@ struct B template