http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56387
Bug #: 56387 Summary: Alias of class template wrongly seen as different Classification: Unclassified Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: pk...@outlook.com Created attachment 29490 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29490 Minimal test case The attached minimal test case creates an alias template of a variadic class template. A function foo2 fails to unify a template template parameter C when given two arguments created using both forms - but only if the object created using the alias template is passed to a parameter expecting a reference. An online 4.8.0 compiler also failed. g++ -c -std=c++11 -Wall -Wextra gcc472templatetemplatebug.cpp The code and error are also listed below: template <int ...Is> struct is1 {}; template <int ...Is> using is2 = is1<Is...>; template <template <int ...> class C, int ...Is, int ...Js> void foo1(C<Is...> a, C<Js...> b) {} template <template <int ...> class C, int ...Is, int ...Js> void foo2(C<Is...> a, C<Js...> &b) {} // ! void test() { is1<1,2,345> x; is2<6,78,90> y; foo1(x,y); foo2(x,y); } // Now the error messages: cc472templatetemplatebug.cpp: In function ‘void test()’: gcc472templatetemplatebug.cpp:18:11: error: no matching function for call to ‘foo2(is1<1, 2, 345>&, is2<6, 78, 90>&)’ gcc472templatetemplatebug.cpp:18:11: note: candidate is: gcc472templatetemplatebug.cpp:11:6: note: template<template<int ...<anonymous> > class C, int ...Is, int ...Js> void foo2(C<Is ...>, C<Js ...>&) gcc472templatetemplatebug.cpp:11:6: note: template argument deduction/substitution failed: gcc472templatetemplatebug.cpp:18:11: note: deduced conflicting types for parameter ‘C<Js ...>’ (‘template<int ...Is> struct is1’ and ‘template<int . ..Is> using is2 = is1<Is ...>’) gcc472templatetemplatebug.cpp: In instantiation of ‘void foo1(C<Is ...>, C<Js ...>) [with C = is1; int ...Is = {1, 2, 345}; int ...Js = {6, 78, 90}]’: gcc472templatetemplatebug.cpp:17:11: required from here gcc472templatetemplatebug.cpp:8:6: warning: unused parameter ‘a’ [-Wunused-parameter] gcc472templatetemplatebug.cpp:8:6: warning: unused parameter ‘b’ [-Wunused-parameter]