https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79832
Bug ID: 79832 Summary: [C++14/17] result of array subscript operator should be xvlaue Product: gcc Version: 6.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: felix.morgner at gmail dot com Target Milestone: --- According to ISO14882:2014 [expr.sub] (as well as the current draft) the following should yield an xvalue on line 3 (arr{}[0]): int main() { using arr = int[3]; arr{}[0]; } since 'arr{}' is an array prvalue. It seems that it does not in GCC since the following code compiles just fine: int main() { using arr = int[3]; &arr{}[0]; } even though taking the address of an xvalue (the result of subscripting the array prvalue) is invalid. There exists a relevant DR1213 (pre C++14) here: http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1213 which introduced the notion that subscripting a non lvalue array yields an xvalue. Compiled using -Wall -Wextra -pedantic with GCC 6.3.1