[llvm-bugs] [Bug 49221] New: [C++4OpenCL] reinterpret_cast from T to T not allowed in some cases
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Feb 17 03:30:27 PST 2021
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: unassignedclangbugs at nondot.org
Reporter: marco.antognini at arm.com
CC: anastasia.stulova at arm.com, llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210217/08de1708/attachment.html>
More information about the llvm-bugs
mailing list