diff options
| author | Jakub Jelinek <jakub@redhat.com> | 2026-01-29 09:49:51 +0100 |
|---|---|---|
| committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2026-01-29 09:49:51 +0100 |
| commit | ef8af34e0d173723a607789cf7cabc61366babbf (patch) | |
| tree | 7fb72f3d7d290984c6e64d0a0bcda351a5786479 /config/math.m4 | |
| parent | 73650105ba44665fe9cdb9f001953bb32e99fec0 (diff) | |
| download | gcc-master.zip gcc-master.tar.gz gcc-master.tar.bz2 | |
c++: Implement CWG3131 - Value categories and types for the range in iterable expansion statementsHEADtrunkmaster
For the https://gcc.gnu.org/pipermail/gcc/2025-November/246977.html
issues I've filed https://github.com/cplusplus/CWG/issues/805
which resulted in two CWG issues,
https://cplusplus.github.io/CWG/issues/3131.html
and
https://cplusplus.github.io/CWG/issues/3140.html
This patch implements the former, changing
the iterating expansion statement http://eel.is/c++draft/stmt.expand#5.2
line from
constexpr auto&& range = expansion-initializer;
to
constexpr decltype(auto) range = (expansion-initializer);
(for our partly pre-CWG3044 implementation with static before it).
2026-01-29 Jakub Jelinek <jakub@redhat.com>
* cp-tree.h (build_range_temp): Implement CWG3131 - Value
categories and types for the range in iterable expansion statements.
Add bool argument defaulted to false.
* parser.cc (build_range_temp): Add expansion_stmt_p argument,
if true build const decltype(auto) __for_range = range_expr instead of
auto &&__for_range = range_expr.
(cp_build_range_for_decls): For expansion stmts build __for_range as
static constexpr decltype(auto) __for_range = (range_expr);
rather than static constexpr auto &&__for_range = range_expr;.
* g++.dg/cpp26/expansion-stmt1.C (N::begin, N::end, O::begin,
O::end): Change argument type from B & to const B & or from
D & to const D &.
* g++.dg/cpp26/expansion-stmt2.C (N::begin, N::end, O::begin,
O::end): Likewise.
* g++.dg/cpp26/expansion-stmt3.C (N::begin, N::end, O::begin,
O::end): Likewise.
* g++.dg/cpp26/expansion-stmt16.C: Expect different diagnostics
for C++11.
* g++.dg/cpp26/expansion-stmt18.C (N::begin, N::end): Change
argument type from B & to const B &.
* g++.dg/cpp26/expansion-stmt25.C (N::begin, N::end): Likewise.
* g++.dg/cpp26/expansion-stmt26.C: New test.
* g++.dg/reflect/p3491-2.C (baz): Move workaround to a new
function garply, use the previously #if 0 guarded implementation.
(garply): New function.
Diffstat (limited to 'config/math.m4')
0 files changed, 0 insertions, 0 deletions
