155. Brace initializer for scalar
Section: 8.5 dcl.init <http://www.open-std.org/jtc1/sc22/wg21/docs/decl.html#dcl.init> Status: open Submitter: Steve Clamage Date: 12 Aug 1999
It is not clear whether the following declaration is well-formed:
Code:
struct S { int i; } s = { { 1 } };
According to 8.5.1 dcl.init.aggr <http://www.open-std.org/jtc1/sc22/wg21/docs/decl.html#dcl.init.aggr> paragraph 2, a brace-enclosed initializer is permitted for a subaggregate of an aggregate; however, i is a scalar, not an aggregate. 8.5 dcl.init <http://www.open-std.org/jtc1/sc22/wg21/docs/decl.html#dcl.init> paragraph 13 says that a standalone declaration like
is permitted, but it is not clear whether this says anything about the form of initializers for scalar members of aggregates.
This is (more) clearly permitted by the C89 Standard.