c++ - "C4430: missing type specifier - int assumed" in a template function -


this code simple, shouldnt compile? lost one.

#include <iostream>  template<typename t> foo(t f) {     std::cout << f << std::endl; }  int main() {     foo(3);      return 0; } 

error:

main.cpp(6): error c4430: missing type specifier - int assumed. note: c++ not support default-int 

you're missing return type foo. presumably, want:

                     vvvv template<typename t> void foo(t f) {                    ^^^^     std::cout << f << std::endl; } 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Socket.connect doesn't throw exception in Android -

iphone - How do I keep MDScrollView from truncating my row headers and making my cells look bad? -