@@ -7892,10 +7892,13 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
{
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 */
@@ -27645,11 +27645,6 @@ cp_parser_late_parsing_default_args (cp_parser *parser, tree fn)
= 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. */
new file mode 100644
@@ -0,0 +1,6 @@
+// { 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
void foo()
{
- new A; // { dg-error "default argument" }
+ new A;
}
@@ -37,6 +37,6 @@ void bar()
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;
}
@@ -9,5 +9,5 @@ struct A
void foo()
{
- A().i; /* { dg-error "default argument" } */
+ A().i;
}
@@ -18,7 +18,7 @@ protected:
template <class T>
void B<T>::g(void) {
- f(); // { dg-error "default argument" }
+ f();
}
template class B<long>;