He is well formed. A is a collection of 1 and, according to project N3936 , an empty list of initializers used in direct -list initialization of the aggregate result in aggregate initialization:
From Β§ 8.5.4 / 3 List-initialization [dcl.init.list] :
An initialization list of an object or link of type T is defined as follows:
- If T is an aggregate, aggregate initialization is performed (8.5.1).
[Example:
struct S2 { int m1; double m2, m3; };
....
S2 s23{}; // OK: default to 0,0,0
....
- end of example]
....
The corresponding changes between C ++ 11 and C ++ 1y are a change in the priority of aggregate initialization and the value for the case of aggregates:
C ++ 11 leads with
An initialization list of an object or link of type T is defined as follows:
- If there are no elements in the initializer list, and T is the type class with the default constructor, the object is initialized with a value.
- Otherwise, if T is an aggregate, aggregate initialization is performed (8.5.1) ....
and then the example above.
C ++ 1y gives priority to aggregate initialization:
An initialization list of an object or link of type T is defined as follows:
- If T is an aggregate, aggregate initialization is performed (8.5.1).
....
- Otherwise, if there are no elements in the initializer list, and T is the class type with the default constructor, the object is initialized with a value.
1 Why A unit?
This is a collection in both C ++ 11 and C ++ 14.
C ++ 1y:
8.5.1 Aggregates [dcl.init.aggr]
An aggregate is an array or class (section 9) without constructors provided by the user (12.1), without private or protected non-static data elements (section 11), without base classes (section 10) and without virtual functions (10.3).
The only part that is not obvious is whether the default constructor is provided for the user or not. Is not:
In Β§ 8.4.2 [dcl.fct.def.default] :
A function is provided to the user if it is declared by the user and not explicitly by default or deleted in his first declaration.