[llvm-bugs] [Bug 43933] New: Clang emits invalid fixit for nested designated initializer
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Nov 7 08:34:40 PST 2019
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: unassignedclangbugs at nondot.org
Reporter: bevin.hansson at ericsson.com
CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
richard-llvm at metafoo.co.uk
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191107/3d1de1d6/attachment.html>
More information about the llvm-bugs
mailing list