Title
Array prvalues and additive operators
Status
open
Section
7.6.6 [expr.add]
Submitter
Andrey Erokhin

Created on 2022-03-08.00:00:00 last changed 2 months ago

Messages

Date: 2022-03-08.00:00:00

Consider

  int main()
  {
    using IA = int[];
    IA{ 1, 2, 3 } + 0;
  }

This appears to be ill-formed given the current wording, because the operand is already a prvalue, thus 7.2.1 [basic.lval] paragraph 6 does not apply and the array-to-pointer conversion is not applied:

Whenever a glvalue appears as an operand of an operator that expects a prvalue for that operand, the lvalue-to-rvalue (7.3.2 [conv.lval]), array-to-pointer (7.3.3 [conv.array]), or function-to-pointer (7.3.4 [conv.func]) standard conversions are applied to convert the expression to a prvalue.

This outcome might be an oversight in the resolution for issue 1232.

See also clang issue 54016.

History
Date User Action Args
2022-03-08 00:00:00admincreate