While compiling: template<typename T> struct Type2Type { typedef T Type; };
template<class T> inline void foo(Type2Type<T> const&) { int x = NOT_HERE; } int main(int, char *) { // std::cout << "Hello world!" << std::endl; } g++ gives an error about NOT_HERE being declared. Rightly so, but the function `foo' is never called or explicity instantiated, so `foo' should never be compiled. >From "14.7.1 Implicit instantiation" of the ISO C++ standard: 9. An implementation shall not implicitly instantiate a function template, a member template, a non-virtual member function, a member class or a static data member of a class template that does not require instantia- tion. -- Summary: template function implicity instatiated Product: gcc Version: 4.0.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: eduffy at gmail dot com GCC host triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26268