In the testcase below (reduced from llvm-llvm) does not ever emit an instantiation of callDefaultCtor<Pass> to the LLVM file, resulting in missing symbols. The #include of <string> and use of .empty() are required to trigger this failure. ----------- struct Pass {} ; template<typename PassName> Pass *callDefaultCtor() { return new PassName(); } void foo(Pass *(*C)()); #include <string> bool foo(std::string &X) { return X.empty(); } void baz() { foo(callDefaultCtor<Pass>); }
Here is a reduced testcase. Note that marking callDefaultCtor 'inline' causes it to be emitted! *boggle* ----- struct Pass {}; template<typename PassName> Pass *callDefaultCtor() { return new Pass(); } void foo(Pass *(*C)()); struct basic_string { bool empty() const { return true; } }; bool foo(basic_string &X) { return X.empty(); } void baz() { foo(callDefaultCtor<Pass>); }
This bug is fixed, patch here: http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20040927/018592.html Testcase here: http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20040927/018591.html It is amazing how all of that quality time spent in GDB ends up with a one line fix, arg. -Chris