This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]