Wandbox
SettingsLog
SettingsLog
Language
GitHubLogin
Ran/Viewed Log

Author

anonymous

over 5 years ago

Language

C++

Compiler

gcc HEAD 10.0.0 20200113 (experimental)

Options
Warnings
Boost 1.72.0
C++2a(GNU)
no pedantic

Author

anonymous

over 5 years ago

$ g++ prog.cc -Wall -Wextra -I/opt/wandbox/boost-1.72.0/gcc-head/include -std=gnu++2a
prog.cc: In function 'int main()':
prog.cc:40:29: error: call of overloaded 'show_value(MyAlpha)' is ambiguous
   40 |     show_value(MyAlpha(BETA));
      |                             ^
prog.cc:28:6: note: candidate: 'void show_value(T) [with T = MyAlpha; typename std::enable_if<std::is_enum<_Tp>::value>::type* <anonymous> = 0]'
   28 | void show_value(T x) { cout<<"Enum: "<<(int)x<<endl; };
      |      ^~~~~~~~~~
prog.cc:30:6: note: candidate: 'void show_value(int)'
   30 | void show_value(int x) { cout<<"Int: "<<x<<endl; };
      |      ^~~~~~~~~~
prog.cc:35:6: note: candidate: 'void show_value(T) [with T = MyAlpha]'
   35 | void show_value(T x) { cout<<"Obj.text: "<<x.text<<endl; };
      |      ^~~~~~~~~~
prog.cc:41:29: error: call of overloaded 'show_value(Animal)' is ambiguous
   41 |     show_value(Animal(RABIT));
      |                             ^
prog.cc:28:6: note: candidate: 'void show_value(T) [with T = Animal; typename std::enable_if<std::is_enum<_Tp>::value>::type* <anonymous> = 0]'
   28 | void show_value(T x) { cout<<"Enum: "<<(int)x<<endl; };
      |      ^~~~~~~~~~
prog.cc:30:6: note: candidate: 'void show_value(int)'
   30 | void show_value(int x) { cout<<"Int: "<<x<<endl; };
      |      ^~~~~~~~~~
prog.cc:35:6: note: candidate: 'void show_value(T) [with T = Animal]'
   35 | void show_value(T x) { cout<<"Obj.text: "<<x.text<<endl; };
      |      ^~~~~~~~~~
prog.cc: In instantiation of 'void show_value(T) [with T = const char*]':
prog.cc:43:27:   required from here
prog.cc:35:46: error: request for member 'text' in 'x', which is of non-class type 'const char*'
   35 | void show_value(T x) { cout<<"Obj.text: "<<x.text<<endl; };
      |                                            ~~^~~~
Exit Code:
1