-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Migrating from https://isocpp.org/files/papers/P1018R18.html#issues
CWG914
Section: 7.6.1.4 [expr.type.conv] Status: extension Submitter: Gabriel Dos Reis Date: 10 June, 2009
Although value-initialization is defined for array types and the () initializer is permitted in a mem-initializer naming an array member of a class, the syntax T() (where is an array type) is explicitly forbidden by 7.6.1.4 [expr.type.conv] paragraph 2. This is inconsistent and the syntax should be permitted.
Rationale (July, 2009):
The CWG was not convinced of the utility of this extension, especially in light of questions about handling the lifetime of temporary arrays. This suggestion needs a proposal and analysis by the EWG before it can be considered by the CWG.
Although value-initialization is defined for array types and the () initializer is permitted in a mem-initializer naming an array member of a class, the syntax T() (where is an array type) is explicitly forbidden by 7.6.1.3 [expr.type.conv] paragraph 2. This is inconsistent and the syntax should be permitted.
Rationale (July, 2009): The CWG was not convinced of the utility of this extension, especially in light of questions about handling the lifetime of temporary arrays. This suggestion needs a proposal and analysis by the EWG before it can be considered by the CWG.
This has become a more severe inconsistency after we adopted Ville’s P0960 for C++20. Now it’s not only () that has this weird special-case restriction, it’s (a, b, c) too:
using X = int[];
X x{1, 2, 3}; // ok, int[3]
X y(1, 2, 3); // ok, int[3]
f(X{1, 2, 3}); // ok, int[3] temporary
f(X(1, 2, 3)); // error
Meeting: (notes) it is a defect, need a paper. David Stone trying to find a volunteer to write said paper. All in favor.