Describe the bug
Comparison of std::shared_ptrs fails. See the test case.
Command-line test case
C:\Temp>type repro.cpp
#include<compare>
#include<memory>
int main()
{
std::shared_ptr<const int> p1;
std::shared_ptr<void> p2;
auto cmp = p1 <=> p2;
}
C:\Temp>cl /std:c++20 repro.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.35.32215 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
repro.cpp
C:\opt\VC\include\memory(1778): error C2446: '<=>': no conversion from 'void *' to 'const int *'
C:\opt\VC\include\memory(1778): note: Conversion from 'void*' to pointer to non-'void' requires an explicit cast
repro.cpp(9): note: see reference to function template instantiation 'std::strong_ordering std::operator <=><const int,void>(const std::shared_ptr<const int> &,const std::shared_ptr<void> &) noexcept'
being compiled
Expected behavior
Successful compilation at least.
Additional notes
This fails as well:
const int *p1;
void *p2;
auto cmp = p1 <=> p2;
But both GCC and Clang compile this successfully!
Describe the bug
Comparison of
std::shared_ptrs fails. See the test case.Command-line test case
Expected behavior
Successful compilation at least.
Additional notes
This fails as well:
But both GCC and Clang compile this successfully!