<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 end location for -Winitializer-overrides with overridden initializers"
href="https://llvm.org/bugs/show_bug.cgi?id=27613">27613</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Wrong end location for -Winitializer-overrides with overridden 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 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.</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>