Am Freitag, dem 25.07.2025 um 20:12 -0700 schrieb Bill Wendling: > On Thu, Jul 24, 2025 at 3:20 PM Martin Uecker <ma.uec...@gmail.com> wrote: > > Am Donnerstag, dem 24.07.2025 um 15:06 -0700 schrieb Bill Wendling: > > > > constexpr size_t size = 4; > > > > struct foo { > > > > char (*buf)[size] __counted_by(size); // two different "size"! > > > > int size; > > > > }; > > > > > >
It is since C23 and the example is accepted as valid ISO C 23 by both GCC and Clang: https://godbolt.org/z/ejKMYbqee You could also repace it with an enumeration constant, it does not make any difference to the name lookup rules in C. > So I suppose what you wrote is > supposed to be C++, which is beyond the scope of this RFC, because C++ > has scoping rules that are far more complex than C's, and also doesn't > allow for VLA's in structs/classes. Without the 'constexpr' keyword, > the above becomes a struct with a VLA in it. But all of this is > besides the point. If we're worried about two different name > resolutions because of a GNU-only feature, then we're getting off > topic. I am not, the example above is valid C. Although GNU extensions is also something GCC needs to care about, so not necessarily offtopic. And even without the "constexpr" it would not be a structure with a VLA, but a structure with a variably-modified type in it, Even though such types are not allowed in structures, WG14 made support for variably-modified types mandatory in ISO C23 (previously support was optional) exactly to be able to improve bounds safety in C. As a future language evolution is also relevant for this discussion, it would also not be off topic. Martin