[Bug c++/62316] New: poor location for missing braces warning

manu at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Aug 30 19:14:00 GMT 2014


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62316

            Bug ID: 62316
           Summary: poor location for missing braces warning
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: manu at gcc dot gnu.org

~/test3/214756M/build/gcc/cc1plus
/home/manuel/test2/src/gcc/testsuite/g++.dg/warn/Wbraces1.C -Wmissing-braces
/home/manuel/test2/src/gcc/testsuite/g++.dg/warn/Wbraces1.C:3:29: warning:
missing braces around initializer for ‘int [2]’ [-Wmissing-braces]
 int a[2][2] = { 0, 1 , 2, 3 }; // { dg-warning "" }
                             ^
/home/manuel/test2/src/gcc/testsuite/g++.dg/warn/Wbraces1.C:3:29: warning:
missing braces around initializer for ‘int [2]’ [-Wmissing-braces]

Since the location info is so poor, it looks as if the warning is duplicated
but probably they refer to two different locations.

Clang++:

/home/manuel/test2/src/gcc/testsuite/g++.dg/warn/Wbraces1.C:3:17: warning:
suggest braces around initialization of subobject [-Wmissing-braces]
int a[2][2] = { 0, 1 , 2, 3 }; // { dg-warning "" }
                ^~~~
                {   }
/home/manuel/test2/src/gcc/testsuite/g++.dg/warn/Wbraces1.C:3:24: warning:
suggest braces around initialization of subobject [-Wmissing-braces]
int a[2][2] = { 0, 1 , 2, 3 }; // { dg-warning "" }
                       ^~~~
                       {   }

The poor location also prevents adding accurate fixit hints.


More information about the Gcc-bugs mailing list