Run Code  | API  | Code Wall  | Misc  | Feedback  | Login  | Theme  | Privacy  | Patreon 

compile c++ gcc online

Language: Layout:
+ ] Compiler args + ] Show input
Compilation time: 0.43 sec, absolute service time: 0.53 sec 
fork mode |  history
Error(s):
source_file.cpp: In function ‘int main()’:
source_file.cpp:16:41: error: no matching function for call to ‘sum(unsigned int, double, float, char)’
         std::cout<<sum(1u, 2.5, 3.f, '0')<<'\n';//doesn't work, don't know why
                                         ^
source_file.cpp:16:41: note: candidates are:
source_file.cpp:2:14: note: template<class T> T sum(T)
     inline T sum(T t){
              ^
source_file.cpp:2:14: note:   template argument deduction/substitution failed:
source_file.cpp:16:41: note:   candidate expects 1 argument, 4 provided
         std::cout<<sum(1u, 2.5, 3.f, '0')<<'\n';//doesn't work, don't know why
                                         ^
source_file.cpp:8:17: note: template<class T, class ... Ts> decltype ((t + sum(sum::ts ...))) sum(T, Ts ...)
     inline auto sum(T t, Ts... ts)->decltype(t+sum(ts...)){
                 ^
source_file.cpp:8:17: note:   template argument deduction/substitution failed:
source_file.cpp: In substitution of ‘template<class T, class ... Ts> decltype ((t + sum(sum::ts ...))) sum(T, Ts ...) [with T = unsigned int; Ts = {double, float, char}]’:
source_file.cpp:16:41:   required from here
source_file.cpp:8:57: error: no matching function for call to ‘sum(double&, float&, char&)’
     inline auto sum(T t, Ts... ts)->decltype(t+sum(ts...)){
                                                         ^
source_file.cpp:8:57: note: candidate is:
source_file.cpp:2:14: note: template<class T> T sum(T)
     inline T sum(T t){
              ^
source_file.cpp:2:14: note:   template argument deduction/substitution failed:
source_file.cpp:8:57: note:   candidate expects 1 argument, 3 provided
     inline auto sum(T t, Ts... ts)->decltype(t+sum(ts...)){
                                                         ^

        

    
                
λ
.NET NoSQL database for rapid development