[llvm-bugs] [Bug 47977] New: reinterpret_cast doesn't work between vector and scalar

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 26 09:38:55 PDT 2020


            Bug ID: 47977
           Summary: reinterpret_cast doesn't work between vector and
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            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

In C++ for OpenCL, the following program doesn't compile:

int2 foo(long x) {
    return reinterpret_cast<int2>(x);

The error is: reinterpret_cast from scalar 'long' to vector 'int2' (vector of 2
'int' values) of different size

This is unexpected. The error message is also wrong: both long and int2 have
the same size.

Replacing the cast with a C-cast works.


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/20201026/fe4ffcbb/attachment.html>

More information about the llvm-bugs mailing list