* pt.c (check_for_bare_parameter_packs): Add loc parameter.
* decl.c (grokdeclarator): Call it for qualifying_scope.
From-SVN: r261725
2018-06-18 Jason Merrill <jason@redhat.com>
+ PR c++/81060 - ICE with unexpanded parameter pack.
+ * pt.c (check_for_bare_parameter_packs): Add loc parameter.
+ * decl.c (grokdeclarator): Call it for qualifying_scope.
+
PR c++/86171 - ICE with recursive alias instantiation.
* pt.c (tsubst_decl): Handle recursive alias instantiation.
extern bool function_parameter_pack_p (const_tree);
extern bool function_parameter_expanded_from_pack_p (tree, tree);
extern tree make_pack_expansion (tree, tsubst_flags_t = tf_warning_or_error);
-extern bool check_for_bare_parameter_packs (tree);
+extern bool check_for_bare_parameter_packs (tree, location_t = UNKNOWN_LOCATION);
extern tree build_template_info (tree, tree);
extern tree get_template_info (const_tree);
extern vec<qualified_typedef_usage_t, va_gc> *get_types_needing_access_check (tree);
break;
if (qualifying_scope)
{
+ if (check_for_bare_parameter_packs (qualifying_scope,
+ id_declarator->id_loc))
+ return error_mark_node;
if (at_function_scope_p ())
{
/* [dcl.meaning]
Returns TRUE and emits an error if there were bare parameter packs,
returns FALSE otherwise. */
bool
-check_for_bare_parameter_packs (tree t)
+check_for_bare_parameter_packs (tree t, location_t loc /* = UNKNOWN_LOCATION */)
{
tree parameter_packs = NULL_TREE;
struct find_parameter_pack_data ppd;
if (parameter_packs)
{
- location_t loc = EXPR_LOC_OR_LOC (t, input_location);
+ if (loc == UNKNOWN_LOCATION)
+ loc = EXPR_LOC_OR_LOC (t, input_location);
error_at (loc, "parameter packs not expanded with %<...%>:");
while (parameter_packs)
{
};
template<typename... T>
-const int A<T>::i // { dg-error "template definition of non-template" }
+const int A<T>::i // { dg-error "packs not expanded" }
= []{ return 0; }(); // BOOM!
// { dg-do compile { target c++11 } }
-template<class... Types> struct B { // { dg-message "declaration of" }
+template<class... Types> struct B {
void f3();
void f4();
};
template<class... Types> void B<Types...>::f3() { } // OK
-template<class... Types> void B<Types>::f4() { } // { dg-error "invalid" }
+template<class... Types> void B<Types>::f4() { } // { dg-error "packs not expanded" }