Commit fdc2ae49 by Jason Merrill Committed by Jason Merrill

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
parent 17e87c1c
2014-12-25 Jason Merrill <jason@redhat.com> 2014-12-25 Jason Merrill <jason@redhat.com>
* 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 PR c++/63522
* parser.c (cp_parser_type_parameter): Call * parser.c (cp_parser_type_parameter): Call
check_for_bare_parameter_packs on default argument. check_for_bare_parameter_packs on default argument.
......
...@@ -4578,13 +4578,8 @@ check_default_tmpl_args (tree decl, tree parms, bool is_primary, ...@@ -4578,13 +4578,8 @@ check_default_tmpl_args (tree decl, tree parms, bool is_primary,
parameter pack, at the end of the template parameter pack, at the end of the template
parameter list. */ parameter list. */
if (TREE_CODE (TREE_VALUE (parm)) == PARM_DECL) error ("parameter pack %q+D must be at the end of the"
error ("parameter pack %qE must be at the end of the"
" template parameter list", TREE_VALUE (parm)); " 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)));
TREE_VALUE (TREE_VEC_ELT (inner_parms, i)) TREE_VALUE (TREE_VEC_ELT (inner_parms, i))
= error_mark_node; = error_mark_node;
...@@ -6524,6 +6519,9 @@ convert_template_argument (tree parm, ...@@ -6524,6 +6519,9 @@ convert_template_argument (tree parm,
tree val; tree val;
int is_type, requires_type, is_tmpl_type, requires_tmpl_type; 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 if (TREE_CODE (arg) == TREE_LIST
&& TREE_CODE (TREE_VALUE (arg)) == OFFSET_REF) && TREE_CODE (TREE_VALUE (arg)) == OFFSET_REF)
{ {
......
...@@ -4,5 +4,5 @@ template<typename..., typename> struct A // { dg-error "parameter pack" } ...@@ -4,5 +4,5 @@ template<typename..., typename> struct A // { dg-error "parameter pack" }
static int i; static int i;
}; };
A<int, int> a; // { dg-error "mismatch|expected|invalid type" } A<int, int> a;
A<char,int> b; // { dg-error "mismatch|expected|invalid type" } A<char,int> b;
...@@ -6,4 +6,4 @@ struct B ...@@ -6,4 +6,4 @@ struct B
template <template <typename...> class C> B(C<int>); template <template <typename...> class C> B(C<int>);
}; };
B b = A<int>(); // { dg-error "mismatch|expected" } B b = A<int>();
// { dg-do compile { target c++11 } } // { dg-do compile { target c++11 } }
template<typename ...T, int = 0> struct A {}; // { dg-error "end of" } template<typename ...T, int = 0> struct A {}; // { dg-error "end of" }
A<int> a; // { dg-error "mismatch|expected|invalid" } A<int> a;
// { dg-do compile { target c++11 } } // { dg-do compile { target c++11 } }
template<typename... Values, typename T> template<typename... Values, typename T> // { dg-error "end" }
struct backward_tuple {}; // { dg-error "end" } struct backward_tuple {};
...@@ -3,4 +3,4 @@ ...@@ -3,4 +3,4 @@
template<typename class T, T = T()> // { dg-error "nested-name-specifier|two or more|valid type" } template<typename class T, T = T()> // { dg-error "nested-name-specifier|two or more|valid type" }
struct A {}; struct A {};
template<int> void foo(A<int>); // { dg-error "mismatch|constant|template argument" } template<int> void foo(A<int>); // { dg-error "cast|argument" "" { target c++98_only } }
...@@ -7,4 +7,4 @@ template<typename> struct B ...@@ -7,4 +7,4 @@ template<typename> struct B
template<int(> struct C; // { dg-error "token" } template<int(> struct C; // { dg-error "token" }
}; };
A<char> a; // { dg-error "type/value mismatch|constant|declaration" } A<char> a;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment