https://bugs.llvm.org/show_bug.cgi?id=43933
Bug ID: 43933
Summary: Clang emits invalid fixit for nested designated
initializer
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Frontend
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected]
Godbolt: https://godbolt.org/z/qKE11h
When the following code is compiled with clang -Wall, it emits a fixit for
adding braces for a subobject initializer:
struct {
signed int x;
struct {
signed int y, z;
} nested;
} i = { .nested.y = 1, 2,
.x = 3,
4 };
<source>:6:16: warning: suggest braces around initialization of subobject
[-Wmissing-braces]
} i = { .nested.y = 1, 2,
^~~~~~~~~~
Clang suggests rewriting the code to this:
struct {
signed int x;
struct {
signed int y, z;
} nested;
} i = { .nested{.y = 1, 2,
.x = 3,
4} };
which is clearly invalid.
Testing on godbolt shows that this bug has existed ever since Clang 3.
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs