<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [C++4OpenCL] reinterpret_cast from T to T not allowed in some cases"
   href="https://bugs.llvm.org/show_bug.cgi?id=49221">49221</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[C++4OpenCL] reinterpret_cast from T to T not allowed in some cases
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>OpenCL
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>marco.antognini@arm.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>anastasia.stulova@arm.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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

}

<a href="https://godbolt.org/z/e7zqTG">https://godbolt.org/z/e7zqTG</a>


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);
}


<a href="https://godbolt.org/z/s7x5zd">https://godbolt.org/z/s7x5zd</a></pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>