<html>
<head>
<base href="http://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 --- - Warning "missing braces around initializer" causing problems with std::array"
href="http://llvm.org/bugs/show_bug.cgi?id=21629">21629</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Warning "missing braces around initializer" causing problems with std::array
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>C++11
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>ehysta@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Similar bug as in GCC: <a href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25137">https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25137</a>
It was resolved with "-Wmissing-braces will no longer be enabled in GCC's -Wall
(for C++ mode), as of 4.8, for precisely the reason you describe.".
Clang: <a href="http://coliru.stacked-crooked.com/a/784733e4c860f68e">http://coliru.stacked-crooked.com/a/784733e4c860f68e</a>
GCC: <a href="http://coliru.stacked-crooked.com/a/5c58c123f2108df5">http://coliru.stacked-crooked.com/a/5c58c123f2108df5</a>
Code:
#include <array>
template<typename T, size_t N>
struct static_array
{
T elems[N];
};
int main() {
std::array<int, 3> a = {1,2,3}; // warning: suggest braces around
initialization of subobject
static_array<int, 3> b = {1,2,3}; // same
return 0;
}</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>