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: unassignedb...@nondot.org
Reporter: nir...@google.com
CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs