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

--- Comment #2 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:d7a18fca936d64d8c6e7ef7c535e2cfc6665aa8d

commit r17-3718-gd7a18fca936d64d8c6e7ef7c535e2cfc6665aa8d
Author: Wang Jinghao <[email protected]>
Date:   Fri Aug 14 17:27:03 2026 -0400

    c++/contracts: contract pack expansion referring to parameter [PR125645]

    Contract conditions are parsed outside the function body, so
    `at_function_scope_p()' is false when their parameter pack expansions
    are formed.  However, function parameter packs in contract conditions
    should use local specializations during substitution, just as they do
    within a function body.

    local_bindings_p seems like a better test than at_function_scope_p, but we
    need to move sk_contract earlier in scope_kind for it to give the right
    answer.

            PR c++/125645

    gcc/cp/ChangeLog:

            * cp-tree.h (PACK_INDEX_PARENTHESIZED_P): Fix incorrect
            documentation in usage.
            * name-lookup.h (enum scope_kind): Move sk_contract before
            sk_function_parms.
            * pt.cc (make_pack_expansion): Use local_bindings_p.

    gcc/testsuite/ChangeLog:

            * g++.dg/contracts/cpp26/fold-pr125645.C: New test.

    Signed-off-by: Wang Jinghao <[email protected]>
    Co-authored-by: Jason Merrill <[email protected]>

Reply via email to