<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - Unused index call of zero-sized array with libcxx causes compile error"
href="https://bugs.llvm.org/show_bug.cgi?id=36241">36241</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Unused index call of zero-sized array with libcxx causes compile error
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</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>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>niravd@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=19812" name="attach_19812" title="failing test.">attachment 19812</a> <a href="attachment.cgi?id=19812&action=edit" title="failing test.">[details]</a></span>
failing test.
The following code no longer compiles with libcxx. It appears to be due to
r324182.
error: non-const lvalue reference to type
'std::__1::array<unsigned int, 0>::value_type' (aka 'unsigned int')
cannot bind to a value of unrelated type 'std::__1::aligned_storage<4,
4>::type'
reference operator[](size_type __n) {return __elems_[__n];}
Command: clang -stdlib=libc++ ~/foo.cc
#include <array>
template <size_t N>
void foo(std::array<uint32_t, N> x) {
for (size_t i = 0; i < N; ++i)
x[i] = x[i]++;
}
void bar() {
foo(std::array<uint32_t, 0>());
return;
}</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>