Author
anonymous
over 2 years ago
Language
C++
Compiler
clang 15.0.0
Options
Warnings
Boost 1.80.0
C++2b
no pedantic
Author
anonymous
over 2 years ago
$ clang++ prog.cc -Wall -Wextra -I/opt/wandbox/boost-1.80.0-clang-15.0.0/include -std=c++2b
prog.cc:7:10: error: no viable conversion from returned value of type 'int' to function return type 'std::reference_wrapper<int>'
return w; // error : C++23から
^
/opt/wandbox/clang-15.0.0/include/c++/v1/__functional/reference_wrapper.h:26:28: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const std::reference_wrapper<int> &' for 1st argument
class _LIBCPP_TEMPLATE_VIS reference_wrapper : public __weak_result_type<_Tp>
^
/opt/wandbox/clang-15.0.0/include/c++/v1/__functional/reference_wrapper.h:26:28: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'std::reference_wrapper<int> &&' for 1st argument
/opt/wandbox/clang-15.0.0/include/c++/v1/__functional/reference_wrapper.h:40:5: note: candidate template ignored: substitution failure [with _Up = int, $1 = void]: call to deleted function '__fun'
reference_wrapper(_Up&& __u) _NOEXCEPT_(noexcept(__fun(declval<_Up>()))) {
^
prog.cc:11:8: warning: unused variable 'r' [-Wunused-variable]
auto r = f();
^
1 warning and 1 error generated.
Exit Code:
1