https://bugs.llvm.org/show_bug.cgi?id=43231
Bug ID: 43231
Summary: -Wmissing-field-initializers warning missing for field
designators
Product: clang
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected],
[email protected]
Given the following code
```
// ~/misc/test.cpp
struct foo {
int x;
int y;
};
void func() {
struct foo f = { 11 };
(void) f;
}
```
And compiling with `bin/clang++ ~/misc/test.cpp -c
-Wmissing-field-initializers`, we get the missing field initializers warning.
```
$ bin/clang++ ~/misc/test.cpp -c -Wmissing-field-initializers
/usr/local/google/home/leonardchan/misc/test.cpp:7:23: warning: missing field
'y' initializer [-Wmissing-field-initializers]
struct foo f = { 11 };
^
1 warning generated.
```
But if we instead initialize `f` with `{ .x = 11 }`, we get no warning. In both
cases, y is still uninitialized but we only get the warning for the first case.
I think we should emit this diagnostic in both cases.
--
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