<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Wrong location for -Wmissing-braces for overriding initializers"
href="https://llvm.org/bugs/show_bug.cgi?id=27614">27614</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Wrong location for -Wmissing-braces for overriding initializers
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>cherepan@mccme.ru
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>