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
Post a Comment