[clang] [CUDA][HIP] make trivial ctor/dtor host device (PR #72394)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 21 07:25:12 PST 2023
bgra8 wrote:
@yxsamliu we found another problem with the patch.
https://godbolt.org/z/5M9eexKKM
```
#include <memory>
template <class T>
class Abc {
public:
Abc();
~Abc();
private:
struct Impl;
std::unique_ptr<Impl> impl_;
};
template <class T>
struct Abc<T>::Impl {
int x;
};
template <class T>
Abc<T>::Abc() : impl_{std::make_unique<Impl>()} {}
template <class T>
Abc<T>::~Abc() {}
template class Abc<int>;
```
```
<source>:23:9: error: reference to __host__ function '~unique_ptr' in __host__ __device__ function
23 | Abc<T>::~Abc() {}
| ^
<source>:25:16: note: in instantiation of member function 'Abc<int>::~Abc' requested here
25 | template class Abc<int>;
| ^
/opt/compiler-explorer/clang-trunk-20231121/bin/../include/c++/v1/__memory/unique_ptr.h:263:59: note: '~unique_ptr' declared here
263 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() { reset(); }
| ^
1 error generated when compiling for sm_86.
Compiler returned: 1
```
https://github.com/llvm/llvm-project/pull/72394
More information about the cfe-commits
mailing list