Currently, clang does not allow static constexpr member
functions called through a reference of an object
in constant expression, e.g. the following code
class static_multimap{
public:
static constexpr int size() noexcept{
return 8;
}
};
template <typename Map>
void test_non_shmem_pair_retrieve(Map& map){
auto constexpr cg_size = map.size();
}
int main(){
static_multimap map;
test_non_shmem_pair_retrieve(map);
return 0;
}fails to compile with clang. (https://godbolt.org/z/T17vTWYcs)
This does not make sense since the evaluation of map.size
does not rely on map. The same code compiles with GCC.