Language
C++
Compiler
clang HEAD 12.0.0 (https://github.com/llvm/llvm-project.git 9087209314caafed4b232d4a66287f2d16054ad3)
Options
Warnings
Boost 1.73.0
C++2a
no pedantic
$ clang++ prog.cc -Wall -Wextra -I/opt/wandbox/boost-1.73.0/clang-head/include -std=c++2a prog.cc:40:11: error: no viable conversion from returned value of type 'B' to function return type 'A'
return b; // C4927
^
prog.cc:11:8: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'B' to 'const A &' for 1st argument
struct A
^
prog.cc:11:8: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'B' to 'A &&' for 1st argument
struct A
^
prog.cc:13:4: note: candidate constructor not viable: no known conversion from 'B' to 'int' for 1st argument
A(int )
^
prog.cc:5:4: note: candidate function
operator int ()
^
prog.cc:41:11: error: no viable conversion from returned value of type 'B' to function return type 'A'
return B(b); // C4927
^~~~
prog.cc:11:8: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'B' to 'const A &' for 1st argument
struct A
^
prog.cc:11:8: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'B' to 'A &&' for 1st argument
struct A
^
prog.cc:13:4: note: candidate constructor not viable: no known conversion from 'B' to 'int' for 1st argument
A(int )
^
prog.cc:5:4: note: candidate function
operator int ()
^
prog.cc:42:11: error: no viable conversion from returned value of type 'B' to function return type 'A'
return f2(b); // C4927
^~~~~
prog.cc:11:8: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'B' to 'const A &' for 1st argument
struct A
^
prog.cc:11:8: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'B' to 'A &&' for 1st argument
struct A
^
prog.cc:13:4: note: candidate constructor not viable: no known conversion from 'B' to 'int' for 1st argument
A(int )
^
prog.cc:5:4: note: candidate function
operator int ()
^
prog.cc:48:6: error: no viable conversion from 'B' to 'A'
A a = b;
^ ~
prog.cc:11:8: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'B' to 'const A &' for 1st argument
struct A
^
prog.cc:11:8: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'B' to 'A &&' for 1st argument
struct A
^
prog.cc:13:4: note: candidate constructor not viable: no known conversion from 'B' to 'int' for 1st argument
A(int )
^
prog.cc:5:4: note: candidate function
operator int ()
^
4 errors generated.
Exit Code:
1