Wandbox
SettingsLog
SettingsLog
Language
GitHubLogin
Ran/Viewed Log

Author

anonymous

about 4 years ago

Language

C++

Compiler

gcc HEAD 12.0.0 20210423 (experimental)

Options
Warnings
Boost 1.73.0
C++2b(GNU)
no pedantic

Author

anonymous

about 4 years ago

$ g++ prog.cc -Wall -Wextra -I/opt/wandbox/boost-1.73.0/gcc-head/include -std=gnu++2b
prog.cc:22:7: error: 'template<class Fn, class T> T Widget::doIt(Fn&&)' cannot be overloaded with 'template<class Fn, class T> T Widget::doIt(Fn&&)'
   22 |     T doIt(Fn&& fn)
      |       ^~~~
prog.cc:16:7: note: previous declaration 'template<class Fn, class T> T Widget::doIt(Fn&&)'
   16 |     T doIt(Fn&& fn)
      |       ^~~~
prog.cc: In function 'int main()':
prog.cc:49:11: error: no matching function for call to 'Widget::doIt(main()::<lambda(Widget2*)>)'
   49 |     w.doIt([](Widget2*){
      |     ~~~~~~^~~~~~~~~~~~~~
   50 |         std::cout << "there will be a 2 here";
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   51 |     });
      |     ~~     
prog.cc:16:7: note: candidate: 'template<class Fn, class T> T Widget::doIt(Fn&&)'
   16 |     T doIt(Fn&& fn)
      |       ^~~~
prog.cc:16:7: note:   template argument deduction/substitution failed:
In file included from prog.cc:1:
/opt/wandbox/gcc-head/include/c++/12.0.0/type_traits: In substitution of 'template<class _Fn, class ... _Args> using invoke_result_t = typename std::invoke_result::type [with _Fn = main()::<lambda(Widget2*)>; _Args = {Widget*}]':
prog.cc:15:27:   required from here
/opt/wandbox/gcc-head/include/c++/12.0.0/type_traits:2933:11: error: no type named 'type' in 'struct std::invoke_result<main()::<lambda(Widget2*)>, Widget*>'
 2933 |     using invoke_result_t = typename invoke_result<_Fn, _Args...>::type;
      |           ^~~~~~~~~~~~~~~
Exit Code:
1