class foo { public: template<typename T> foo(int i) : j(i) {} template<typename T> void bar(int i) { j = i; } template<typename T> static void baz(int i) {} int j; }; int main() { foo::baz<bool>(3); foo* p; p->bar<bool>(3); new foo<bool>(3); return 0; } gets you: ~/ootbc/chips$ g++ foo.cc foo.cc: In function âint main()â: foo.cc:8: error: âfooâ is not a template foo.cc:8: error: no matching function for call to âfoo::foo(int)â foo.cc:1: note: candidates are: foo::foo(const foo&) The problem is that the constructor was declared as a template, hence cannot be called (see bug# 29008). This can be detected at the declaration and a warning should issue. OK.
diagnosing this would be useful and shouldn't require instantiation, it should be detectable during phase 1 reduced: struct foo { template<typename T> foo(int); };