Bug 102611 - [C++23] P2128R6 - Multidimensional subscript operator
Summary: [C++23] P2128R6 - Multidimensional subscript operator
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 12.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: c++23-core
  Show dependency treegraph
 
Reported: 2021-10-05 16:18 UTC by Marek Polacek
Modified: 2021-10-19 09:48 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
gcc12-P2128R6-WIP.patch (6.96 KB, patch)
2021-10-13 14:42 UTC, Jakub Jelinek
Details | Diff
gcc12-pr102611.patch (8.41 KB, patch)
2021-10-13 18:24 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marek Polacek 2021-10-05 16:18:06 UTC
See https://wg21.link/p2128r6
Comment 1 Jakub Jelinek 2021-10-06 13:13:48 UTC
Maybe during parsing we should represent the ARRAY_REF if either there is no expression (i.e. []) or there are ,s some other way (perhaps NULL for [], either TREE_LIST or TREE_VEC etc. for 2+) and then for builtin array ref if we see a parameter pack, try to expand it and error out on the [] case (or empty pack) and for 2+ case turn it with a deprecation diagnostics into COMPOUND_EXPR(s) (unless from a pack, then error?).
And for the overloaded case handle it like call lookup (perhaps with diagnosed backwards compatibility fallback if the expression list would be valid compound expression and lookup would succeed for that compound expression as argument to single operand operator[]).
Comment 2 Jakub Jelinek 2021-10-13 14:42:07 UTC
Created attachment 51595 [details]
gcc12-P2128R6-WIP.patch

Untested WIP, just template handling hasn't been added yet, so it is useful only without templates so far.
Comment 3 Jakub Jelinek 2021-10-13 18:24:46 UTC
Created attachment 51596 [details]
gcc12-pr102611.patch

Updated patch that handles even templates, including pack expansions.