Closed Grismolk closed 5 years ago
#include "nonstd/value_ptr.hpp"
#include <iostream>
int main()
{
nonstd::value_ptr<double> vptr1 = 10.01;
nonstd::value_ptr<double> vptr2 = 20.02;
vptr2 = nonstd::value_ptr<double>(30.03); // L9: does not compile
vptr2 = std::move(vptr1); // L10: does not compile
std::cout << vptr2.value() << std::endl;
std::cout << vptr1.value() << std::endl;
}
Compiling with:
clang-cl -std:c++14 -EHsc -I../include/ issue-6-move-assignment.cpp
Yields:
In file included from issue-6-move-assignment.cpp:1:
../include\nonstd/value_ptr.hpp(764,13): error: no matching member function for call to 'reset'
ptr.reset( std::move( rhs.ptr ) );
~~~~^~~~~
issue-6-move-assignment.cpp(9,11): note: in instantiation of member function
'nonstd::vptr::value_ptr<double,
nonstd::vptr::detail::default_clone<double>, std::default_delete<double> >::operator=' requested here
vptr2 = nonstd::value_ptr<double>(30.03);
^
../include\nonstd/value_ptr.hpp(547,10):
note: candidate function not viable: no known conversion from
'remove_reference_t
<
nonstd::vptr::detail::compressed_ptr
<
double
, nonstd::vptr::detail::default_clone<double>
, std::default_delete<double>
> &
>'
(aka 'nonstd::vptr::detail::compressed_ptr<double, nonstd::vptr::detail::default_clone
to
'nonstd::vptr::detail::compressed_ptr
<
double
, nonstd::vptr::detail::default_clone<double>
,std::default_delete<double>
>::pointer'
(aka 'double *')
for 1st argument void reset( pointer p ) nsvp_noexcept
Thanks
Hello. Compile time error in this case:
Edited(mm): added c++ codeblock delimiters