<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/116922>116922</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[CUDA][HIP] shared variable not allowed with trivial ctor
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
aywala
</td>
</tr>
</table>
<pre>
Similar with https://github.com/llvm/llvm-project/issues/72261
```cpp
struct A {
A(){}
~A() {}
int x;
};
#define __device__ __attribute__((device))
#define __shared__ __attribute__((shared))
__device__ A x;
__device__ void foo() {
__shared__ A y; // error with clang, ok with nvcc
}
```
https://github.com/llvm/llvm-project/pull/73140 fixed global device var init, but non-global shared var still fails.
@yxsamliu
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycU0GPmzwQ_TXmMtrIjCGQAweyUfR9t0pVz8gYJ0zr4Mg2ZHPpb6_AbDdpe2mlaALveTzz5jHSezoPWlcs37P8kMgx9NZV8n6TRiat7e7VZ7qQkQ5uFHroQ7h6JmqGR4bHM4V-bDfKXhgejZne_16uzn7VKjA8kvej9gyPBeI2ZfzAeL3GLY8_db1GxAc3qgA1sGIfEYCaYclwNyPF4R38vqLwDNMQ4I2JNXcmfj7HiKLTJxo0NE2nJ1K6aaBpZAiO2jHoplmuLSM3V8Xd75m-l053f86M3FPmEh_q1Y8t_kpOljo4Wfsgb9X2ULeGOxN7gOgBaOfs6o4ycjgzfAX7LQLDpNTHNJ7HHl__2tDraMxsp0gzDid60x2cjW2lgagCJumABgpzH-0YYLDDy3oiSlhO-EDGwEmS8Zu1sYzf37y8GBohIklXiW4ndjLRVVoI5CUKLpK-OqEqhciFaFvBy0KJrpCFzJTK8lSeFCZUIccsTZHzPC9RbIpiW5YiT4tUb3mRlyzj-iLJbGZ1G-vOyfKhVmm63SEmRrba-GUpEAd9g4VliPOOuGoZSTuePcu4IR_8xzWBglm26fXLoWb5geX7__7_xPLDg3iSrdEw2ADSGHvTXTQrOJpIGlDBumR0pvr3ZVtlTBX-CAAA___E2SqE">