<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/58590>58590</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [C++4OpenCL] Improve diagnostics of kernel param types
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            OpenCL
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          AnastasiaStulova
      </td>
    </tr>
</table>

<pre>
    C++ for OpenCL made some diagnostics for kernel param types more conservative and sometimes even incorrect. For example OpenCL C didn't disallow use of forward declared types but in C++ for OpenCL they are not allowed due to standard layout and other C++ specific requirement failing.

One of the biggest problems though that templated types are not diagnosed correctly when passed by reference or pointer due to lazy template instantiation.

One idea explained in https://reviews.llvm.org/D134445 is to turn such incorrect diagnostics into warning instead with possibility to disable the warning by a flag. The warning could inform that diagnosing type is not possible and that developers need to do manual checking of their correctness. This is better than preventing using the types due to inability of correct diagnosing.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxtU12PmzAQ_DXwsmpEgKS5Bx7uQydVqnQP7R8w9kLcMza1TdL013cMJNfrNbIC2Luzs7Pj1qlL85iVD1jUOU8vI9vHrzQIxRTcwKS06K0LUcswB7yyt2xoFF4MFC8jBxqcZ5LOBvYnEfWJSVg1Z0c94JxPbElb6bxnGTf0DBj-JYbR8LXeI-oom5WfI16CMMadaQpMrktFz8IrUiyN8KzWou0UgUn_4R6PfCFEknWRZigkqYkpOgoR1BKaERcHhETUIcHfgMLIUndakuefk_Y8sI3UCW207TdZ8ZQV98v_i53pIZla3fccIo3etYaHgE039Uc8RKTIaFTEG_Ers1VY7K_CmAudj1BqFCHtthdQ6NizlSjkaXTaRhBdOzHi9-WGDSVSZ1FDfmc_0NSKBRRHqLZAhmzHGMeQVfdZ-Yzl-aT5HDbGnIaN8z22nrZVXdc70iEVi5O3FCZ5fBvjO2OAmSNMyUKkmQsLRWcdj2Adgm6hXrwkoDRcSDSrdo1Ho4I6I_oNff9rW7rJJK6Y7LAouVZMh0nKxC0JuZQwi-uWQDjOuJE9AjgJj8IOnraTMCSPLF8TxjI87a_6Ww4hUQAsVssxqQ08TMQnC8eUNC3lwXOZ5joNbcXaJFD_USgZJ-dmu8fvrtxt97lqKnVX3Yk86mi4yXYPq_vqxcLZ7om-DHDT6f39A_bH65dP3jTv59lD-andSDfgIw11fXwC5A8ww6cOYeKAl91hd1fkx2anum3NQrZtxYVq1fZQV0XV1gc-yLYqi9yIlk1IZLOyXHmWJajmuimLstwW6K0oDtV-c-i4lGJfCtmpot5zVhc84ArdDJb7ZubTTn3AodEhvrkvh_91j8HNtYAvJtwn39xbAZMHLb7FybiTyOcemrmBPxfCrJ4">