diff options
author | Jakub Jelinek <jakub@redhat.com> | 2025-07-07 09:17:34 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2025-07-07 09:25:15 +0200 |
commit | 66455591fac1e80b5acc615598cbf556d565e080 (patch) | |
tree | d43f2c38aba059b27a4770c4ef7ed1b4765dcfed /libgo/go/sync/once_test.go | |
parent | 849878d4fd40ad4ac2bff9a7bfe50176051d7176 (diff) | |
download | gcc-master.zip gcc-master.tar.gz gcc-master.tar.bz2 |
https://eel.is/c++draft/stmt.ranged#2
says that in for-range-declaration only type-specifier or constexpr
can appear. As the following testcases show, we've emitted some
diagnostics in most cases, but not for static/thread_local (the patch
handles __thread too) and register in the non-sb case.
For extern there was an error that it is both extern and has an
initializer (again, non-sb only, sb errors on extern).
The following patch diagnoses those cases with pedwarn.
I've used for-range-declaration in the diagnostics wording (there was
already a case of that for the typedef), so that in the future
we don't need to differentiate it between range for and expansion
statements.
2025-07-07 Jakub Jelinek <jakub@redhat.com>
PR c++/84009
* parser.cc (cp_parser_decomposition_declaration): Pedwarn
on thread_local, __thread or static in decl_specifiers for
for-range-declaration.
(cp_parser_init_declarator): Likewise, and also for extern
or register.
* g++.dg/cpp0x/range-for40.C: New test.
* g++.dg/cpp0x/range-for41.C: New test.
* g++.dg/cpp0x/range-for42.C: New test.
* g++.dg/cpp0x/range-for43.C: New test.
Diffstat (limited to 'libgo/go/sync/once_test.go')
0 files changed, 0 insertions, 0 deletions