Author
anonymous
over 3 years ago
Language
C++
Compiler
gcc 11.1.0
Options
Boost 1.76.0
C++17
no pedantic
Author
anonymous
over 3 years ago
$ g++ prog.cc -I/opt/wandbox/boost-1.76.0/gcc-11.1.0/include -std=c++17
prog.cc: In function 'int main()':
prog.cc:49:41: error: no matching function for call to 'testclass1::SetFunction<std::string, double>(void (&)(std::string*, double*))'
49 | tc1.SetFunction<std::string, double>(some_function);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
prog.cc:12:10: note: candidate: 'template<class ... Ts> void testclass1::SetFunction(testclass1::TFunc<Ts ...>)'
12 | void SetFunction(TFunc<Ts...> tf)
| ^~~~~~~~~~~
prog.cc:12:10: note: template argument deduction/substitution failed:
prog.cc:49:41: note: mismatched types 'std::function<void(Ts* ...)>' and 'void (*)(std::string*, double*)' {aka 'void (*)(std::__cxx11::basic_string<char>*, double*)'}
49 | tc1.SetFunction<std::string, double>(some_function);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
Exit Code:
1