diff options
| author | Jakub Jelinek <jakub@redhat.com> | 2026-02-04 12:29:24 +0100 |
|---|---|---|
| committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2026-02-04 12:29:24 +0100 |
| commit | 75930efa22fb722e734307332a81ed1505178ae6 (patch) | |
| tree | 0864bc828ebf37a7389b1eaf6fc16ec6c73c24fd /libjava/classpath/java/sql | |
| parent | da50e9a7936a8a8226b4c3b7d8624074d014beef (diff) | |
| download | gcc-75930efa22fb722e734307332a81ed1505178ae6.zip gcc-75930efa22fb722e734307332a81ed1505178ae6.tar.gz gcc-75930efa22fb722e734307332a81ed1505178ae6.tar.bz2 | |
c++: Perform the iterating expansion stmt N evaluation in immediate context [PR123611]
For the N evaluation for iterating expansion stmts where the standard says
to evaluate:
[] consteval {
std::ptrdiff_t result = 0;
for (auto i = begin; i != end; ++i) ++result;
return result; // distance from begin to end
}()
right now (subject to further changes in CWG3140) I wanted to save compile
time/memory and effort to actually construct the lambda and it is evaluated
just using TARGET_EXPRs. On the following testcase it makes a difference,
when the lambda is consteval, the expressions inside of it are evaluated
in immediate context and so the testcase should be accepted, but we
currently reject it when i has consteval-only type and expansion stmt
doesn't appear in an immediate or immediate-escalating function.
The following patch fixes this by forcing in_immediate_context () to be true
around the evaluation.
2026-02-04 Jakub Jelinek <jakub@redhat.com>
PR c++/123611
* pt.cc (finish_expansion_stmt): Temporarily enable
in_immediate_context () for the iterating expansion stmt N
computation.
* g++.dg/reflect/expansion-stmt1.C: New test.
Diffstat (limited to 'libjava/classpath/java/sql')
0 files changed, 0 insertions, 0 deletions
