https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121539

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:4bed19cf6170541ff757ee1b21d9fec9eb0c6541

commit r16-3224-g4bed19cf6170541ff757ee1b21d9fec9eb0c6541
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Fri Aug 15 22:34:59 2025 +0200

    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  <ja...@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.

Reply via email to