gnu/gcc/d7a18fca936d64d8c6e7ef7c535e2cfc6665aa8d 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 <zheng.xianyuwang@gmail.com>
Co-authored-by: Jason Merrill <jason@redhat.com>
4 files changed