This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 116a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-12-19


304. Value-initialization of a reference

Section: 9.4  [dcl.init]     Status: TC1     Submitter: Steve Adamczyk     Date: 25 Jul 2001

Another glitch in the TC1/core issue 178 definition of value-initialization: it's no longer an error to value-initialize a reference. That makes an example like

typedef struct { int &r; } S;
int main() {
  S();  // Error in C++98, okay in TC1!
}
valid, which has got to be wrong. See 9.4 [dcl.init] paragraph 5, where there is wording that forbids default-initialization of a reference, but not value-initialization thereof. As noted in issue 302, if the default constructor were required to be generated when a value-initialization is done, that would force an error.

Proposed resolution (10/01):

Add the indicated wording to the indicated sentence in 9.4 [dcl.init] paragraph 5:

A program that calls for default-initialization or value-initialization of an entity of reference type is ill-formed.