diff options
author | Jakub Jelinek <jakub@redhat.com> | 2024-03-08 09:11:57 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2024-03-08 09:29:30 +0100 |
commit | 3ecc5071797c4ceb6da67a6c2b2527a046091de2 (patch) | |
tree | 51ba851ec7d90df49d807c68acb2a5f5a8956bf7 /gcc/c/c-tree.h | |
parent | 1329dacdc0fbe7d43550294fe8b0323a6dc5ce9e (diff) | |
download | gcc-3ecc5071797c4ceb6da67a6c2b2527a046091de2.zip gcc-3ecc5071797c4ceb6da67a6c2b2527a046091de2.tar.gz gcc-3ecc5071797c4ceb6da67a6c2b2527a046091de2.tar.bz2 |
c++: Fix up parameter pack diagnostics on xobj vs. varargs functions [PR113802]
The simple presence of ellipsis as next token after the parameter
declaration doesn't imply it is a parameter pack, it sometimes is, e.g.
if its type is a pack, but sometimes is not and in that case it acts
the same as if the next tokens were , ... instead of just ...
The xobj param cannot be a function parameter pack though treats both
the declarator->parameter_pack_p and token->type == CPP_ELLIPSIS as
sufficient conditions for the error. The conditions for CPP_ELLIPSIS
are done a little bit later in the same function and complex enough that
IMHO shouldn't be repeated, on the other side for the
declarator->parameter_pack_p case we clear that flag for xobj params
for error recovery reasons.
This patch just moves the diagnostics later (after the CPP_ELLIPSIS handling)
and changes the error recovery behavior by pretending the this specifier
didn't appear if an error is reported.
2024-03-08 Jakub Jelinek <jakub@redhat.com>
PR c++/113802
* parser.cc (cp_parser_parameter_declaration): Move the xobj_param_p
pack diagnostics after ellipsis handling and if an error is reported,
pretend this specifier didn't appear. Formatting fix.
* g++.dg/cpp23/explicit-obj-diagnostics3.C (S0, S1, S2, S3, S4): Don't
expect any diagnostics on f and fd member function templates, add
similar templates with ...Selves instead of Selves as k and kd and
expect diagnostics for those. Expect extra diagnostics in error
recovery for g and gd member function templates.
Diffstat (limited to 'gcc/c/c-tree.h')
0 files changed, 0 insertions, 0 deletions