Title
Array temporaries in reference binding
Status
nad
Section
9.4.4 [dcl.init.ref]
Submitter
Vinny Romano

Created on 2015-04-02.00:00:00 last changed 16 months ago

Messages

Date: 2016-03-15.00:00:00

Rationale (March, 2016):

Whether to support creating a temporary array in such cases is a question of language design and thus should be considered by EWG.

EWG 2022-11-11

The intent is adequately expressed in the specification.

Date: 2022-11-20.07:54:16

The current wording of the Standard appears to permit code like

  void f(const char (&)[10]);
  void g() {
    f("123");
    f({'a','b','c','\0'});
  }

creating a temporary array of ten elements and binding the parameter reference to it. This is controversial and should be reconsidered. (See issues 1058 and 1232.)

History
Date User Action Args
2022-11-24 21:06:23adminsetstatus: extension -> nad
2017-02-06 00:00:00adminsetmessages: + msg5997
2017-02-06 00:00:00adminsetstatus: open -> extension
2015-04-02 00:00:00admincreate