diff options
author | Jakub Jelinek <jakub@redhat.com> | 2025-08-15 22:34:59 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2025-08-15 22:34:59 +0200 |
commit | 4bed19cf6170541ff757ee1b21d9fec9eb0c6541 (patch) | |
tree | f3170b998dc66f2f436f619b5b92229db996cae8 /libjava/classpath | |
parent | cdd015c4ddbb1ae71eea1e44654cee5ca29a6c64 (diff) | |
download | gcc-4bed19cf6170541ff757ee1b21d9fec9eb0c6541.zip gcc-4bed19cf6170541ff757ee1b21d9fec9eb0c6541.tar.gz gcc-4bed19cf6170541ff757ee1b21d9fec9eb0c6541.tar.bz2 |
c++: Fix default argument parsing in non-comma variadic methods [PR121539]
While the non-comma variadic functions/methods were deprecated in C++26,
they are still valid and they are valid without deprecation in C++98 to
C++23.
We parse default arguments followed by ...) outside of classes or
for out of class definitions of methods, but I think since C++11 support
in GCC 4.9 or so we consider ... to be a part of a default argument and
error on it.
I think a default argument can't validly contain a pack expansion
that ends the expression with ..., so I think we can simply handle
...) if at depth 0 as not part of the default argument.
2025-08-15 Jakub Jelinek <jakub@redhat.com>
PR c++/121539
* parser.cc (cp_parser_cache_defarg): Set done to true for
CPP_ELLIPSIS followed by CPP_CLOSE_PAREN in !nsdmi at depth 0.
* g++.dg/parse/defarg20.C: New test.
Diffstat (limited to 'libjava/classpath')
0 files changed, 0 insertions, 0 deletions