https://llvm.org/bugs/show_bug.cgi?id=27613
Bug ID: 27613 Summary: Wrong end location for -Winitializer-overrides with overridden initializers Product: clang Version: trunk Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P Component: -New Bugs Assignee: unassignedclangb...@nondot.org Reporter: chere...@mccme.ru CC: llvm-bugs@lists.llvm.org Classification: Unclassified Source code: ---------------------------------------------------------------------- int main() { struct s { int x, y; } s1 = { 1, 2 }; struct { struct s sub; int z; } s2 = { .sub = s1, .sub = 3, 4, 5 }; (void)s2; } ---------------------------------------------------------------------- Results: ---------------------------------------------------------------------- $ clang -std=c11 -Weverything -O3 test.c && ./a.out test.c:4:60: warning: subobject initialization overrides initialization of other fields within its enclosing subobject [-Winitializer-overrides] struct { struct s sub; int z; } s2 = { .sub = s1, .sub = 3, 4, 5 }; ^~~~~~~~~ test.c:4:49: note: previous initialization is here struct { struct s sub; int z; } s2 = { .sub = s1, .sub = 3, 4, 5 }; ^~ test.c:4:60: warning: suggest braces around initialization of subobject [-Wmissing-braces] struct { struct s sub; int z; } s2 = { .sub = s1, .sub = 3, 4, 5 }; ^~~~ { } 2 warnings generated. ---------------------------------------------------------------------- clang version: clang version 3.9.0 (trunk 268228) The first warning underlines "3, 4, 5 }". I think it should underline "3, 4" only. -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs