http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53162
Bug #: 53162 Summary: unexpanded parameter packs not diagnosed in alias template used in default argument Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Keywords: accepts-invalid, diagnostic Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: r...@gcc.gnu.org template<bool B> struct bool_constant { static const bool value = B; }; template<bool> struct enable_if { }; template<> struct enable_if<true> { typedef void type; }; template<typename... A> struct F { template<typename... B> using SameSize = bool_constant<sizeof...(A) == sizeof...(B)>; template<typename... B, typename = SameSize<B>> F(int, B...) { } template<typename... B, typename = typename enable_if<SameSize<B>::value>::type> F(char, B...) { } }; int main() { F<int, int> f1(1, 2, 3); F<int, int> f2('1', 2, 3); } $ g++ -std=c++11 t.cc t.cc: In instantiation of ‘struct F<int, int>’: t.cc:27:17: required from here t.cc:22:3: error: no type named ‘type’ in ‘struct enable_if<false>’ F(char, B...) { } ^ The declaration of f1 should be rejected because the F(int, B...) constructor's default template argument refers to the parameter pack B without expanding it, but there is no error. The declaration of f1 is rejected but with an unhelpful diagnostic, if the problem was that there's no 'type' in enable_if then it should result in a substitution failure not an error. The actual problem is that B is not expanded in SameSize<B>, so the error should say so.