[llvm-bugs] [Bug 36241] New: Unused index call of zero-sized array with libcxx causes compile error
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Feb 5 12:24:08 PST 2018
https://bugs.llvm.org/show_bug.cgi?id=36241
Bug ID: 36241
Summary: Unused index call of zero-sized array with libcxx
causes compile error
Product: new-bugs
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: niravd at google.com
CC: llvm-bugs at lists.llvm.org
Created attachment 19812
--> https://bugs.llvm.org/attachment.cgi?id=19812&action=edit
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;
}
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180205/162febb7/attachment.html>
More information about the llvm-bugs
mailing list