c++ - Why am I getting "error: type name is not allowed" with these spaghetti templates? -
this question has answer here: where , why have put “template” , “typename” keywords? 5 answers i have following code bit of "spaghetti" of templates: template <typename a, typename b, typename... args> class c { /*... */ bar& getbar() { /* ... */ } public: template <typename u> static void foo() { a = geta<u>(); baz& bar = getbar(); bar.frob<u>(a); /* @@@ */ } /*... */ } /* no template */ class d : public c<somea, d, const somee&> { /* ... */ } /* no template */ class f : public d { /* ... */} and when try compile function following statement: d::foo<f>(); i error type name not allowed , on line marked @@@ . why getting that? know when try call function type name, doesn't i'm doing here. it's classic template ambiguity, unfortunat...