Re: [Patch] C++: Handle OpenMP/OpenACC array sections [: / :] with C++26
Jakub Jelinek <[email protected]>
| Newsgroups | gmane.comp.gcc.patches |
|---|---|
| Message-ID | <amyVgwxIfzi4wrAR@tucnak> |
On Fri, Jul 31, 2026 at 01:40:28PM +0200, Tobias Burnus wrote: > OpenMP/OpenACC supports array sections of the form: > map ( var[start_idx : length] ) > where either can be left out (the start index is then 0 > and the length is taken from the type, if available.) > > Hence, 'var[:n]', var[:], and 'var[3:]' might appear. While with > a space before and after the ':', there is no issue, this changes Note, OpenMP has not just these, but also var[low:len:stride] where all 3 are optional, so it is also about var[::] and var[:len:] etc. I'm not excited about this change, but agree I can't think of cases ambiguous right now, but please give Jason time to think of some. It would be certainly useful to have testsuite coverage that shows that valid splice expressions etc. are parsed correctly even in array sections with c++26/-freflection, say constexpr int a = 42; constexpr auto b = ^^a; int c[128]; clause (c[[:b:]]) etc. Jakub