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.

From-SVN: r261725
This commit is contained in:
Jason Merrill 2018-06-18 20:38:26 -04:00 committed by Jason Merrill
parent 094c2a2373
commit cae39eb41f
6 changed files with 14 additions and 6 deletions

View file

@ -1,5 +1,9 @@
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.

View file

@ -6626,7 +6626,7 @@ extern bool template_parameter_pack_p (const_tree);
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);

View file

@ -10175,6 +10175,9 @@ grokdeclarator (const cp_declarator *declarator,
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]

View file

@ -4031,7 +4031,7 @@ make_pack_expansion (tree arg, tsubst_flags_t complain)
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;
@ -4055,7 +4055,8 @@ check_for_bare_parameter_packs (tree t)
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)
{

View file

@ -7,5 +7,5 @@ template<typename... T> struct A
};
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!

View file

@ -1,8 +1,8 @@
// { 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" }