From: jason Date: Thu, 25 Dec 2014 07:28:01 +0000 (+0000) Subject: * pt.c (check_default_tmpl_args): Uses the parameter source X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b97cebebd189d4ebf44e3bad2c13886c6c264303;p=thirdparty%2Fgcc.git * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@219067 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4eb871273428..bd5dd4955956 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 f5bd842df0eb..21d0d3aa4e9c 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 1f2ea50972e7..2048077c36a6 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 7fd20e7ca55d..b4c737c603c8 100644 --- a/gcc/testsuite/g++.dg/cpp0x/pr31442.C +++ b/gcc/testsuite/g++.dg/cpp0x/pr31442.C @@ -6,4 +6,4 @@ struct B template