The following code:

struct S
{ int x[3]; };

void f()
{ S s = {1,2,3};}

With -Wmissing-braces (which is implied by -Wall, among others) gives:

warning: missing braces around initializer for 'int [3]'

In the specific case where a struct contains only a single array, adding the
extra braces doesn't really seem that useful.

The reason it would be nice to fix this that in the definition of tr1::array in
the TR1 specification (page 88, 6.2.2) says

2.An array is an aggregate ([dcl.init.aggr]) that can be initialized with the
syntax 
array a = { initializer-list }; 
where initializer-list is a comma separated list of up to N elements whose
types are convertible to T.


-- 
           Summary: Warning "missing braces around initializer" causing
                    problems with tr1::array
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: chris at bubblescope dot net


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25137

Reply via email to