Wandbox
SettingsLog
SettingsLog
Language
GitHubLogin
Ran/Viewed Log

Author

anonymous

over 4 years ago

Language

C++

Compiler

gcc 9.3.0

Options
Warnings
Boost 1.72.0
C++11
no pedantic

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:57:28: error: cannot convert 'B<A_derived1>' to 'const B<A>&'
   57 |     std::cout << c1.result(b1) << std::endl; // error: cannot convert 'B<A_derived1>' to 'const B<A>&'
      |                            ^~
      |                            |
      |                            B<A_derived1>
prog.cc:37:29: note:   initializing argument 1 of 'virtual int C_derived1::result(const B<A>&) const'
   37 |     int result(const B<A> & b) const{ return param_ * b.point() * 3; }
      |                ~~~~~~~~~~~~~^
prog.cc:58:28: error: cannot convert 'B<A_derived2>' to 'const B<A>&'
   58 |     std::cout << c1.result(b2) << std::endl;
      |                            ^~
      |                            |
      |                            B<A_derived2>
prog.cc:37:29: note:   initializing argument 1 of 'virtual int C_derived1::result(const B<A>&) const'
   37 |     int result(const B<A> & b) const{ return param_ * b.point() * 3; }
      |                ~~~~~~~~~~~~~^
prog.cc:59:28: error: cannot convert 'B<A_derived1>' to 'const B<A>&'
   59 |     std::cout << c2.result(b1) << std::endl;
      |                            ^~
      |                            |
      |                            B<A_derived1>
prog.cc:43:29: note:   initializing argument 1 of 'virtual int C_derived2::result(const B<A>&) const'
   43 |     int result(const B<A> & b) const{ return param_ * b.point() * 10; }
      |                ~~~~~~~~~~~~~^
prog.cc:60:28: error: cannot convert 'B<A_derived2>' to 'const B<A>&'
   60 |     std::cout << c2.result(b2) << std::endl;
      |                            ^~
      |                            |
      |                            B<A_derived2>
prog.cc:43:29: note:   initializing argument 1 of 'virtual int C_derived2::result(const B<A>&) const'
   43 |     int result(const B<A> & b) const{ return param_ * b.point() * 10; }
      |                ~~~~~~~~~~~~~^
Exit Code:
1