https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110686
Bug ID: 110686 Summary: problem with explicit Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: irip at qq dot com Target Milestone: --- Test template name resolution, such as: template <char k> struct N { template <char p> struct S23{ typedef long X; void g(void) { try {} catch (typename ::N<k>::S<P>::S23<p>::X) {} } }; }; Compiler error: 'typename N::S' names 'template template struct N::S', which is not a type expected unqualified-id before '<' token expected ')' before '<' token expected '{' before '<' token expected primary-expression before '<' token '::X' has not been declared expected '; ' before ')' token Error occurs when using typename and nested namespace templates. The C++ standard describes that the typename prefix should be used when a nested form such as ::N<k>::S<P>::S23<p>::X represents a type rather than a member of the currently instantiated template.