https://bugs.llvm.org/show_bug.cgi?id=49221
Bug ID: 49221
Summary: [C++4OpenCL] reinterpret_cast from T to T not allowed
in some cases
Product: clang
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: OpenCL
Assignee: unassignedclangb...@nondot.org
Reporter: marco.antogn...@arm.com
CC: anastasia.stul...@arm.com, llvm-bugs@lists.llvm.org
When casting T to T using reinterpret_cast is often not allowed. This might be
on purpose sometimes, but there are cases when I believe it should be
supported. For example:
kernel void foo() {
int x;
auto y = reinterpret_cast<decltype(x)>(x);
// error: reinterpret_cast from 'int' to 'decltype(x)' (aka '__private int')
is not allowed
}
kernel void goo() {
reserve_id_t x;
auto y = reinterpret_cast<reserve_id_t>(x);
// error: reinterpret_cast from 'reserve_id_t' to 'reserve_id_t' is not
allowed
}
https://godbolt.org/z/e7zqTG
While this is allowed:
kernel void foo() {
int x;
auto y = (decltype(x))(x);
}
kernel void goo() {
reserve_id_t x;
auto y = (reserve_id_t)(x);
}
https://godbolt.org/z/s7x5zd
--
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