[llvm-bugs] [Bug 27614] New: Wrong location for -Wmissing-braces for overriding initializers
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue May 3 02:49:02 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=27614
Bug ID: 27614
Summary: Wrong location for -Wmissing-braces for overriding
initializers
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: cherepan at mccme.ru
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
Source code:
----------------------------------------------------------------------
int main()
{
struct { struct { int x; } sub; } s = { .sub = { 1 }, .sub = 2 };
(void)s;
}
----------------------------------------------------------------------
Results:
----------------------------------------------------------------------
$ clang -std=c11 -Weverything -O3 test.c && ./a.out
test.c:3:65: warning: initializer overrides prior initialization of this
subobject [-Winitializer-overrides]
struct { struct { int x; } sub; } s1 = { .sub = { 1 }, .sub = 2 };
^
test.c:3:53: note: previous initialization is here
struct { struct { int x; } sub; } s1 = { .sub = { 1 }, .sub = 2 };
^
test.c:3:51: warning: suggest braces around initialization of subobject
[-Wmissing-braces]
struct { struct { int x; } sub; } s1 = { .sub = { 1 }, .sub = 2 };
^~~~~
{ }
test.c:4:51: warning: suggest braces around initialization of subobject
[-Wmissing-braces]
struct { struct { int x; } sub; } s2 = { .sub = 1, .sub = 2 };
^
{}
test.c:4:61: warning: initializer overrides prior initialization of this
subobject [-Winitializer-overrides]
struct { struct { int x; } sub; } s2 = { .sub = 1, .sub = 2 };
^
test.c:4:51: note: previous initialization is here
struct { struct { int x; } sub; } s2 = { .sub = 1, .sub = 2 };
^
test.c:4:51: warning: suggest braces around initialization of subobject
[-Wmissing-braces]
struct { struct { int x; } sub; } s2 = { .sub = 1, .sub = 2 };
^~~~~~~~~~~
{ }
5 warnings generated.
----------------------------------------------------------------------
clang version: clang version 3.9.0 (trunk 268228)
I guess the 2nd and 5th warnings intended to warn about missing braces around
"2" only.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160503/35c1c197/attachment-0001.html>
More information about the llvm-bugs
mailing list