[Bug c++/99980] Delayed parsing of noexcept doesn't work in member function template

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Dec 16 22:40:34 GMT 2021


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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:06041b2c67a5d4d0941c53990f0438a309703ed0

commit r12-6025-g06041b2c67a5d4d0941c53990f0438a309703ed0
Author: Marek Polacek <polacek@redhat.com>
Date:   Wed Dec 15 17:41:53 2021 -0500

    c++: delayed noexcept in member function template [PR99980]

    Some time ago I noticed that we don't properly delay parsing of
    noexcept for member function templates.  This patch fixes that.

    It didn't work because even though we set CP_PARSER_FLAGS_DELAY_NOEXCEPT
    in cp_parser_member_declaration, member template declarations take
    a different path: we call cp_parser_template_declaration and return
    prior to setting the flag.

            PR c++/99980

    gcc/cp/ChangeLog:

            * parser.c (cp_parser_single_declaration): Maybe pass
            CP_PARSER_FLAGS_DELAY_NOEXCEPT down to cp_parser_init_declarator.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/noexcept71.C: New test.


More information about the Gcc-bugs mailing list