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.
*** This bug has been marked as a duplicate of 26267 ***