Author
anonymous
almost 4 years ago
Language
C++
Compiler
gcc HEAD 12.0.0 20210522 (experimental)
Options
Don't Use Boost
C++17
-pedantic-errors
Author
anonymous
almost 4 years ago
$ g++ prog.cc -std=c++17 -pedantic-errors
prog.cc:13:3: error: redefinition of 'template<class T, class F, class R> R evaluate(F&&, std::vector<T>)'
13 | R evaluate(F&& f, std::vector<T> args) {
| ^~~~~~~~
prog.cc:8:3: note: 'template<class T, class F, class R> R evaluate(F&&, std::vector<T>)' previously declared here
8 | R evaluate(F&& f, std::vector<T> args) {
| ^~~~~~~~
prog.cc: In function 'int main()':
prog.cc:23:34: error: no matching function for call to 'evaluate<double>(main()::<lambda(double, double)>&, <brace-enclosed initializer list>)'
23 | auto result2 = evaluate<double>(func2, {1,2.});
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
prog.cc:8:3: note: candidate: 'template<class T, class F, class R> R evaluate(F&&, std::vector<T>)'
8 | R evaluate(F&& f, std::vector<T> args) {
| ^~~~~~~~
prog.cc:8:3: note: template argument deduction/substitution failed:
In file included from /opt/wandbox/gcc-head/include/c++/12.0.0/bits/move.h:57,
from /opt/wandbox/gcc-head/include/c++/12.0.0/bits/nested_exception.h:40,
from /opt/wandbox/gcc-head/include/c++/12.0.0/exception:148,
from /opt/wandbox/gcc-head/include/c++/12.0.0/ios:39,
from /opt/wandbox/gcc-head/include/c++/12.0.0/ostream:38,
from /opt/wandbox/gcc-head/include/c++/12.0.0/iostream:39,
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(double, double)>&; _Args = {double}]':
prog.cc:7:34: 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(double, double)>&, double>'
2933 | using invoke_result_t = typename invoke_result<_Fn, _Args...>::type;
| ^~~~~~~~~~~~~~~
Exit Code:
1