===================================================================
@@ -20673,6 +20673,8 @@ cp_parser_default_argument (cp_parser *parser, boo
}
if (BRACE_ENCLOSED_INITIALIZER_P (default_argument))
maybe_warn_cpp0x (CPP0X_INITIALIZER_LISTS);
+ if (check_for_bare_parameter_packs (default_argument))
+ default_argument = error_mark_node;
if (template_parm_p)
pop_deferring_access_checks ();
parser->greater_than_is_operator_p = saved_greater_than_is_operator_p;
@@ -26403,6 +26405,9 @@ cp_parser_late_parsing_default_args (cp_parser *pa
continue;
}
+ if (check_for_bare_parameter_packs (parsed_arg))
+ parsed_arg = error_mark_node;
+
TREE_PURPOSE (parm) = parsed_arg;
/* Update any instantiations we've already created. */
===================================================================
@@ -0,0 +1,18 @@
+// PR c++/69095
+// { dg-do compile { target c++11 } }
+
+struct B1 {
+ template <typename Ret, typename... Args, unsigned = sizeof(Args)> // { dg-error "parameter packs not expanded" }
+ void insert(Ret);
+};
+
+struct B2 {
+ template <typename Ret, typename... Args>
+ void insert(Ret, unsigned = sizeof(Args)); // { dg-error "parameter packs not expanded" }
+};
+
+template <typename Ret, typename... Args, unsigned = sizeof(Args)> // { dg-error "parameter packs not expanded" }
+void insert1(Ret);
+
+template <typename Ret, typename... Args>
+void insert2(Ret, unsigned = sizeof(Args)); // { dg-error "parameter packs not expanded" }