Commit 1aeafba2 by Jason Merrill Committed by Jason Merrill

Fix default argument conversion failure and SFINAE.

	* call.c (build_over_call): Check convert_default_arg result for
	error_mark_node.
	* parser.c (cp_parser_late_parsing_default_args): Remember
	error_mark_node.

From-SVN: r251421
parent a2aa807e
2017-08-29 Jason Merrill <jason@redhat.com>
Fix default argument conversion failure and SFINAE.
* call.c (build_over_call): Check convert_default_arg result for
error_mark_node.
* parser.c (cp_parser_late_parsing_default_args): Remember
error_mark_node.
2017-08-28 Nathan Sidwell <nathan@acm.org> 2017-08-28 Nathan Sidwell <nathan@acm.org>
* cp-tree.h (lang_type): Replace sorted_fields vector with * cp-tree.h (lang_type): Replace sorted_fields vector with
......
...@@ -7892,10 +7892,13 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) ...@@ -7892,10 +7892,13 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
{ {
if (TREE_VALUE (parm) == error_mark_node) if (TREE_VALUE (parm) == error_mark_node)
return error_mark_node; return error_mark_node;
argarray[j++] = convert_default_arg (TREE_VALUE (parm), val = convert_default_arg (TREE_VALUE (parm),
TREE_PURPOSE (parm), TREE_PURPOSE (parm),
fn, i - is_method, fn, i - is_method,
complain); complain);
if (val == error_mark_node)
return error_mark_node;
argarray[j++] = val;
} }
/* Ellipsis */ /* Ellipsis */
......
...@@ -27645,11 +27645,6 @@ cp_parser_late_parsing_default_args (cp_parser *parser, tree fn) ...@@ -27645,11 +27645,6 @@ cp_parser_late_parsing_default_args (cp_parser *parser, tree fn)
= cp_parser_late_parse_one_default_arg (parser, parmdecl, = cp_parser_late_parse_one_default_arg (parser, parmdecl,
default_arg, default_arg,
TREE_VALUE (parm)); TREE_VALUE (parm));
if (parsed_arg == error_mark_node)
{
continue;
}
TREE_PURPOSE (parm) = parsed_arg; TREE_PURPOSE (parm) = parsed_arg;
/* Update any instantiations we've already created. */ /* Update any instantiations we've already created. */
// { dg-do compile { target c++11 } }
// { dg-options "" }
template<class T> struct Foo { Foo(T = nullptr) {} };
static_assert (!__is_constructible(Foo<int>));
...@@ -10,5 +10,5 @@ struct A ...@@ -10,5 +10,5 @@ struct A
void foo() void foo()
{ {
new A; // { dg-error "default argument" } new A;
} }
...@@ -37,6 +37,6 @@ void bar() ...@@ -37,6 +37,6 @@ void bar()
int i; int i;
i.C::foo<0>(); /* { dg-error "which is of non-class type" } */ i.C::foo<0>(); /* { dg-error "which is of non-class type" } */
S<false> s; /* { dg-error "default argument" } */ S<false> s;
SS<false> ss; SS<false> ss;
} }
...@@ -9,5 +9,5 @@ struct A ...@@ -9,5 +9,5 @@ struct A
void foo() void foo()
{ {
A().i; /* { dg-error "default argument" } */ A().i;
} }
...@@ -18,7 +18,7 @@ protected: ...@@ -18,7 +18,7 @@ protected:
template <class T> template <class T>
void B<T>::g(void) { void B<T>::g(void) {
f(); // { dg-error "default argument" } f();
} }
template class B<long>; template class B<long>;
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