<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/57881>57881</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[C++4OpenCL] Cannot use struct as kernel parameter when accessing through templated struct
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
biggysmith
</td>
</tr>
</table>
<pre>
Hi,
I'm having some issues when using certain types as kernel parameters. Whenever I try to use a struct defined in template type I get compile errors:
```cpp
struct test_param0{
public:
struct constants_t{
int size;
};
};
template<typename T>
struct test_param1{
public:
struct constants_t{
int size;
};
};
// this compiles fine
kernel void test_kernel0(
__read_only image3d_t src_volume,
__write_only image3d_t dst_img,
__constant test_param0::constants_t& c
)
{
}
// this does not compile
// error: '__constant test_param1<int>::constants_t &__private' cannot be used as the type of a kernel parameter'
kernel void test_kernel1(
__read_only image3d_t src_volume,
__write_only image3d_t dst_img,
__constant test_param1<int>::constants_t& c
)
{
}
```
Is this some sort of OpenCL C++ limitation? It *feels* like it should be ok.
--
cmd: clang -target spirv64 -emit-llvm -cl-std=clc++2021 -O0 -c -o output.bc input.clcpp
using llvm 15
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzNVc-PozoM_mvCxaLiR4H2wGGmfaM30pP2stIeUQgu5E0gKAkddf_6dYB2p6OZvay0WhSREDvxZ3-2qXVzKf-VLDmw6Miih-X9zJKih46f5dCC1T2CtHZCC68dDjBZvy3QOC4HcJeRBNzCC5oBFYzc8B4dGrsB-Eb6eEYDz-DMBZymwwgcrDOTcNDgSQ7YgL8G-1Fxh_N9pN6iA6H7USoENEYby9KHtxhZHi1DjOOys17q0LpqRhGx4nERjVOtpLjdAPSs2kIP1vHB2crdtGF95ODAyu_I0jcCVhxv33fr-X11g6UH78hAoYCvLP3nE4Txn0fIkica4DpprwG24GlYxCuLZy2bBeeyEbFkB_fPT4NVZZA3lR7UBWTPW0ybinAZUZ21mnqk7LrTfjXS4Xv1hmzJvvW6d8pX9-94pTClD28Dk-Qgrv7tP8JJoXu_cYTP4tJoismgbxl4pzFnI5kHKpIP4cVEPhHjWX-Pk87kVTUaefY5khQg-ODt1OgLo_Fl5Lq1BvSJCuV9UdGZX_IU_008_SIQv0fYtfTXbmUX1uZGZbVxPnRfqPgO_8GBJY80QMleOu6kHlj6BPDsmXg4ISpLM0lfqMVRKDo9qcazoV82b5MjDJdZ9I1nXihOHTB03Pg2ZUdpzvkWQiQboVLnHkKhQutI9yiUWCAkURJD-CUCEkKoQU9unNymFlTEfkGK47g6uHTY-aY4C7CM8zwtdlGc5kFTps0-3fPASaewZNnj6uJ28ZhlRzgsSeVb7dpDPmjPSy_nQqCdrbnO6Kntbo24Wc8Gk1Fl59w4N-C5BFrpuqneUHHQh0e5TuFo9P8oiNyn5X9Bi6zY7eKgK-tTvY_3aSwS3BY8j1JRZKd9kp9226Lm-TZQvCY2vEMsSQZ8XX45tCaPAllS-JJon8RxEe2yfNPQKjqdeIZZnm3zhG0j7LlUG49jo00bmHKGVE-tJaGS1tmfQk4-twPO8fP388l12pS1bNuLJRa7YLZezuh_ACa1LCg">