decl_specifiers.locations[ds_this] = 0;
}
- if (xobj_param_p
- && ((declarator && declarator->parameter_pack_p)
- || cp_lexer_next_token_is (parser->lexer, CPP_ELLIPSIS)))
- {
- location_t xobj_param
- = make_location (decl_specifiers.locations[ds_this],
- decl_spec_token_start->location,
- input_location);
- error_at (xobj_param,
- "an explicit object parameter cannot "
- "be a function parameter pack");
- /* Suppress errors that occur down the line. */
- if (declarator)
- declarator->parameter_pack_p = false;
- }
-
/* If a function parameter pack was specified and an implicit template
parameter was introduced during cp_parser_parameter_declaration,
change any implicit parameters introduced into packs. */
(INNERMOST_TEMPLATE_PARMS (current_template_parms));
if (latest_template_parm_idx != template_parm_idx)
- decl_specifiers.type = convert_generic_types_to_packs
- (decl_specifiers.type,
- template_parm_idx, latest_template_parm_idx);
+ decl_specifiers.type
+ = convert_generic_types_to_packs (decl_specifiers.type,
+ template_parm_idx,
+ latest_template_parm_idx);
}
if (cp_lexer_next_token_is (parser->lexer, CPP_ELLIPSIS))
}
}
+ if (xobj_param_p
+ && (declarator ? declarator->parameter_pack_p
+ : PACK_EXPANSION_P (decl_specifiers.type)))
+ {
+ location_t xobj_param
+ = make_location (decl_specifiers.locations[ds_this],
+ decl_spec_token_start->location,
+ input_location);
+ error_at (xobj_param,
+ "an explicit object parameter cannot "
+ "be a function parameter pack");
+ xobj_param_p = false;
+ decl_specifiers.locations[ds_this] = 0;
+ }
+
/* The restriction on defining new types applies only to the type
of the parameter, not to the default argument. */
parser->type_definition_forbidden_message = saved_message;
struct S0 {
template<typename Selves>
- void f(this Selves...) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" }
+ void f(this Selves...) {}
template<typename Selves>
void g(this Selves... selves) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" }
+ // { dg-error "contains no parameter packs" "" { target *-*-* } .-1 }
void h(this auto...) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" }
void j(this auto... selves) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" }
+ template<typename ...Selves>
+ void k(this Selves...) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" }
+
template<typename Selves>
- void fd(this Selves...); // { dg-error "an explicit object parameter cannot be a function parameter pack" }
+ void fd(this Selves...);
template<typename Selves>
void gd(this Selves... selves); // { dg-error "an explicit object parameter cannot be a function parameter pack" }
+ // { dg-error "contains no parameter packs" "" { target *-*-* } .-1 }
void hd(this auto...); // { dg-error "an explicit object parameter cannot be a function parameter pack" }
void jd(this auto... selves); // { dg-error "an explicit object parameter cannot be a function parameter pack" }
+
+ template<typename ...Selves>
+ void kd(this Selves...); // { dg-error "an explicit object parameter cannot be a function parameter pack" }
};
struct S1 {
template<typename Selves>
- void f(this Selves&...) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" }
+ void f(this Selves&...) {}
template<typename Selves>
void g(this Selves&... selves) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" }
+ // { dg-error "contains no parameter packs" "" { target *-*-* } .-1 }
void h(this auto&...) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" }
void j(this auto&... selves) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" }
+ template<typename ...Selves>
+ void k(this Selves&...) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" }
+
template<typename Selves>
- void fd(this Selves&...); // { dg-error "an explicit object parameter cannot be a function parameter pack" }
+ void fd(this Selves&...);
template<typename Selves>
void gd(this Selves&... selves); // { dg-error "an explicit object parameter cannot be a function parameter pack" }
+ // { dg-error "contains no parameter packs" "" { target *-*-* } .-1 }
void hd(this auto&...); // { dg-error "an explicit object parameter cannot be a function parameter pack" }
void jd(this auto&... selves); // { dg-error "an explicit object parameter cannot be a function parameter pack" }
+
+ template<typename ...Selves>
+ void kd(this Selves&...); // { dg-error "an explicit object parameter cannot be a function parameter pack" }
};
struct S2 {
template<typename Selves>
- void f(this Selves&&...) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" }
+ void f(this Selves&&...) {}
template<typename Selves>
void g(this Selves&&... selves) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" }
+ // { dg-error "contains no parameter packs" "" { target *-*-* } .-1 }
void h(this auto&&...) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" }
void j(this auto&&... selves) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" }
+ template<typename ...Selves>
+ void k(this Selves&&...) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" }
+
template<typename Selves>
- void fd(this Selves&&...); // { dg-error "an explicit object parameter cannot be a function parameter pack" }
+ void fd(this Selves&&...);
template<typename Selves>
void gd(this Selves&&... selves); // { dg-error "an explicit object parameter cannot be a function parameter pack" }
+ // { dg-error "contains no parameter packs" "" { target *-*-* } .-1 }
void hd(this auto&&...); // { dg-error "an explicit object parameter cannot be a function parameter pack" }
void jd(this auto&&... selves); // { dg-error "an explicit object parameter cannot be a function parameter pack" }
+
+ template<typename ...Selves>
+ void kd(this Selves&&...); // { dg-error "an explicit object parameter cannot be a function parameter pack" }
};
struct S3 {
template<typename Selves>
- void f(this Selves const&...) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" }
+ void f(this Selves const&...) {}
template<typename Selves>
void g(this Selves const&... selves) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" }
+ // { dg-error "contains no parameter packs" "" { target *-*-* } .-1 }
void h(this auto const&...) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" }
void j(this auto const&... selves) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" }
+ template<typename ...Selves>
+ void k(this Selves const&...) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" }
+
template<typename Selves>
- void fd(this Selves const&...); // { dg-error "an explicit object parameter cannot be a function parameter pack" }
+ void fd(this Selves const&...);
template<typename Selves>
void gd(this Selves const&... selves); // { dg-error "an explicit object parameter cannot be a function parameter pack" }
+ // { dg-error "contains no parameter packs" "" { target *-*-* } .-1 }
void hd(this auto const&...); // { dg-error "an explicit object parameter cannot be a function parameter pack" }
void jd(this auto const&... selves); // { dg-error "an explicit object parameter cannot be a function parameter pack" }
+
+ template<typename ...Selves>
+ void kd(this Selves const&...); // { dg-error "an explicit object parameter cannot be a function parameter pack" }
};
struct S4 {
template<typename Selves>
- void f(this Selves const&&...) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" }
+ void f(this Selves const&&...) {}
template<typename Selves>
void g(this Selves const&&... selves) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" }
+ // { dg-error "contains no parameter packs" "" { target *-*-* } .-1 }
void h(this auto const&&...) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" }
void j(this auto const&&... selves) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" }
+ template<typename ...Selves>
+ void k(this Selves const&&...) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" }
+
template<typename Selves>
- void fd(this Selves const&&...); // { dg-error "an explicit object parameter cannot be a function parameter pack" }
+ void fd(this Selves const&&...);
template<typename Selves>
void gd(this Selves const&&... selves); // { dg-error "an explicit object parameter cannot be a function parameter pack" }
+ // { dg-error "contains no parameter packs" "" { target *-*-* } .-1 }
void hd(this auto const&&...); // { dg-error "an explicit object parameter cannot be a function parameter pack" }
void jd(this auto const&&... selves); // { dg-error "an explicit object parameter cannot be a function parameter pack" }
-};
+ template<typename ...Selves>
+ void kd(this Selves const&&...); // { dg-error "an explicit object parameter cannot be a function parameter pack" }
+};