Language
C++
Compiler
gcc 9.3.0
Options
Warnings
Boost 1.72.0
C++11
no pedantic
$ g++ prog.cc -Wall -Wextra -I/opt/wandbox/boost-1.72.0/gcc-9.3.0/include -std=c++11
Exit Code:
1
Author
anonymous
over 4 years ago
C++
gcc 9.3.0
Author
anonymous
over 4 years ago
$ g++ prog.cc -Wall -Wextra -I/opt/wandbox/boost-1.72.0/gcc-9.3.0/include -std=c++11
prog.cc: In function 'int main()':
prog.cc:44:14: error: invalid initialization of reference of type 'const B<A>&' from expression of type 'B<A_derived1>'
44 | displayB(b1);
| ^~
prog.cc:28:28: note: in passing argument 1 of 'void displayB(const B<A>&)'
28 | void displayB(const B<A> & b){
| ~~~~~~~~~~~~~^
prog.cc:45:14: error: invalid initialization of reference of type 'const B<A>&' from expression of type 'B<A_derived2>'
45 | displayB(b2);
| ^~
prog.cc:28:28: note: in passing argument 1 of 'void displayB(const B<A>&)'
28 | void displayB(const B<A> & b){
| ~~~~~~~~~~~~~^