+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>
* cp-tree.h (lang_type): Replace sorted_fields vector with
{
if (TREE_VALUE (parm) == error_mark_node)
return error_mark_node;
- argarray[j++] = convert_default_arg (TREE_VALUE (parm),
- TREE_PURPOSE (parm),
- fn, i - is_method,
- complain);
+ val = convert_default_arg (TREE_VALUE (parm),
+ TREE_PURPOSE (parm),
+ fn, i - is_method,
+ complain);
+ if (val == error_mark_node)
+ return error_mark_node;
+ argarray[j++] = val;
}
/* Ellipsis */
= cp_parser_late_parse_one_default_arg (parser, parmdecl,
default_arg,
TREE_VALUE (parm));
- if (parsed_arg == error_mark_node)
- {
- continue;
- }
-
TREE_PURPOSE (parm) = parsed_arg;
/* Update any instantiations we've already created. */
--- /dev/null
+// { dg-do compile { target c++11 } }
+// { dg-options "" }
+
+template<class T> struct Foo { Foo(T = nullptr) {} };
+
+static_assert (!__is_constructible(Foo<int>));
void foo()
{
- new A; // { dg-error "default argument" }
+ new A;
}
int i;
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;
}
void foo()
{
- A().i; /* { dg-error "default argument" } */
+ A().i;
}
template <class T>
void B<T>::g(void) {
- f(); // { dg-error "default argument" }
+ f();
}
template class B<long>;