http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59416
Bug ID: 59416 Summary: A nested template reusing the template arguments of the enclosing type in a template template argument not working Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ville.voutilainen at gmail dot com Test: template<int,int> struct Obj; template<typename... Ts> struct A { template<template<Ts...> class> struct B { }; }; int main() { A<int,int>::B<Obj> x{ }; } edoceo3.cpp:8:20: error: type/value mismatch at argument 1 in template parameter list for ‘template<class ... Ts> template<template<template<Ts ...<anonymous> > class<template-parameter-2-1> > template<class ... Ts> template<Ts ...<anonymous> > class<template-parameter-2-1> > struct A<Ts>::B’ A<int,int>::B<Obj> x{ }; ^ edoceo3.cpp:8:20: error: expected a template of type ‘template<class ... Ts> template<Ts ...<anonymous> > class<template-parameter-2-1>’, got ‘template<int <anonymous>, int <anonymous> > struct Obj’ edoceo3.cpp:8:23: error: invalid type in declaration before ‘{’ token A<int,int>::B<Obj> x{ }; clang compiles this code. It certainly looks valid to me, since in the attempted instantiation, A's template arguments are 'int,int', and then the template argument for A::B should be 'template <int, int> class', and Obj is such a template.