https://bugs.llvm.org/show_bug.cgi?id=45024
Bug ID: 45024
Summary: Cannot write to std::array inside CUDA __device__
lambda
Product: clang
Version: 9.0
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangb...@nondot.org
Reporter: rgovos...@gmail.com
CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
neeil...@live.com, richard-l...@metafoo.co.uk
--------
#include <array>
int main() {
auto l = [] __device__ () {
std::array<int, 1> x;
x[0] = 1;
};
return 0;
}
--------
When compiled with `clang++ -std=c++14 test.cu` this fails with:
test.cu:6:8: error: cannot assign to return value because function 'operator[]'
returns a const value
x[0] = 1;
~~~~ ^
This appears only to be the case if this is a __device__ lambda. Otherwise the
array is writable as expected.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs