<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/60653>60653</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Nvcc can be compiled using the -- expt-relaxed-constexpr option, and clang will report an error. I don't know if there is a corresponding option to compile this case
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
4465464
</td>
</tr>
</table>
<pre>
#include<bits/stdc++.h>
#include "cuda_runtime.h"
namespace cuco{
namespace detail{
template <typename viewT>
__global__ void insert(viewT view){
view.insert();
}
}
template <typename Key>
class static_multimap{
public:
~static_multimap()=default;
static_multimap(){
}
void insert(){
auto view = get_device_mutable_view();
detail::insert<<<1,1,0>>>(view);
}
static constexpr bool uses_vector_load() noexcept{
return false;
}
class device_view_impl_base;
class device_mutable_view_impl;
template <typename ViewImpl>
class device_view_base{
protected:
__host__ __device__ device_view_base() noexcept:impl_{}{
}
protected:
ViewImpl impl_;
}; //class device_view_base
class device_mutable_view:public device_view_base<device_mutable_view_impl>{
public:
__host__ __device__ device_mutable_view() noexcept{
}
__device__ __forceinline__ void insert() noexcept;
private:
using device_view_base<device_mutable_view_impl>::impl_;
}; //class device mutable view
device_mutable_view get_device_mutable_view() const noexcept{
return device_mutable_view();
}
};
template <typename Key>
__device__ __forceinline__ void
static_multimap<Key>::device_mutable_view::insert() noexcept{
impl_.insert<uses_vector_load()>(23);
}
template <typename Key>
class static_multimap<Key>::device_view_impl_base{
protected:
static constexpr bool uses_vector_load() noexcept{
return false;
}
__host__ __device__ device_view_impl_base() noexcept{
}
}; //class device_view_impl_base
template <typename Key>
class static_multimap<Key>::device_mutable_view_impl:public device_view_impl_base{
public:
__host__ __device__ device_mutable_view_impl() noexcept : device_view_impl_base{}{}
template <bool uses_vector_load>
__device__ __forceinline__ std::enable_if_t<uses_vector_load,void> insert(int a) noexcept{}
template <bool uses_vector_load>
__device__ __forceinline__ std::enable_if_t<not uses_vector_load,void> insert(int a) noexcept{}
}; //class device_mutable_view_impl
} //namespace cuco
template<typename TestType>
void test_cuco(){
cuco::static_multimap<int> map{};
map.insert();
}
int main(){
test_cuco<int64_t>();
}
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8V01v8joT_TVmMypKbQiwYMFHKz16pXf16G4jx5mA73XsKJ7QdnN_-1WclEAILY_uB6KpSMbHZ86Mjx3pvT5YxDWbb9l8P5E1HV21ns3i-SyeTVKXfawZF9oqU2fIxC7V5Bl_9ZQpxreMb6dHJl5YtGfRpg8ExrmqM5lUtSVd4PTIOO-CwtXKAn0pFYKqlWOLbXsbAKB_lCFJbfqHhEVpJCEwsaOPEptIOGl8-3mmAN0nSQ7GpdIkCZyczkBbjxUxvgzhYRDjqx66uTE9BzWPxPYakS32_Y3zj_Y6Sux_-HGmpYz0HjxJ0iopakO6kOVV1mWdGq2Y6BDhz2Fwx2qfYS5rQ1f8xmMv4QeEB6IMo5uPrMkFWYCJPRyQkgxPWmFS1CRTg0mr4bVWXcXEholNhy527feZ8fAXNaK037YaQ7GHVM_5gXLWE76XFaTOGag9-uSEilyVGCezlgxYh-8KS7rJqEKqKwu5NB6_nLGtVpduQzHRRWmSVA7GXcVdyhLiz6Ffde9vGt9-hOCXO7gBL0x9zqesHKEizPp2Obf90XlKEkg-q5Xc4gxkEpuQXQO_2N-INlKN0K53KXxmBC3qUGexBcZfGX-9k-RgrrsSM7Fpl8wthNjdL8nLhYqDFfe9hLedf9tsD6l3AZ0kuasUamu0xRu3ui7UdlgDfZKENxnUXtvDr8rSLtnHSwYdSmulgxxHJvraQdql_e3SfcCBesUD819y6e_K0kYNzVbsOowg4Xir9nZ4z6OC9NOzZ457W2uaXFxm_M9sRaNJDKzvG__5myb9sDs_YHM95y-2hEGnwF1f6tH-JZ1HFuSYuY1UYuTg8LiFtVNdKwRMbO5P2u4Pg3pcKjFe8su97Ys15ilrZUEbOOo8GV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