Open
Description
Similar with #72261
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
}
#73140 fixed global device var init, but non-global shared var still fails.
nvcc does not check host device attribute for either global device var or shared var.
nvcc even does not report error when constructor for shared var is not empty ( just report warning, but the constructor will never be called).
https://godbolt.org/z/5T9fKdavn
https://godbolt.org/z/GqW6PTG18