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

--- Comment #10 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Jason Merrill <[email protected]>:

https://gcc.gnu.org/g:943089ca86f81fb6eba004af17a8d714b3b8b35b

commit r17-3710-g943089ca86f81fb6eba004af17a8d714b3b8b35b
Author: Wang Jinghao <[email protected]>
Date:   Wed Aug 26 08:39:17 2026 -0700

    c++/contracts: unify condition for pseudo-template mode [PR125537]

    These three functions had different conditions for when a postcondition was
    parsed/substituted in pseudo-template mode, leading to problems with trying
    to substitute non-template trees.  Consistently use/expect this approach
    only for postconditions with result identifiers and deduced return types.

            PR c++/125537

    gcc/cp/ChangeLog:

            * pt.cc (tsubst_contract): Keep template processing enabled
            only for postconditions with an undeduced result binding.
            * contracts.cc (rebuild_postconditions): Only rebuild
            undeduced result variable.
            * parser.cc (cp_parser_late_contract_condition): Enable
            pseudo-template mode only for result bindings whose return
            type has not yet been deduced.  Do not immediately rebuild
            postconditions that have already completed late parsing.

    gcc/testsuite/ChangeLog:

            * g++.dg/contracts/cpp26/template-post1.C: New test.
            * g++.dg/contracts/cpp26/contracts-class1.C: New test.

Reply via email to