http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47942
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-03-01 13:45:26 UTC --- (In reply to comment #2) > Your options are either to use C++0x mode (classes without linkage can be used > as template arguments in C++0x) or to upcast the pointer It seems that the change to allow local types as template args (see http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2657.htm for the proposal) was implemented in GCC 4.5, so you can't rely on that in 4.4 So the best option is: return BasePtr(static_cast<Base*>(new InlineImpl));