diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index 731836b0b1dd9e464d8ccf94aa3d6863b6a112df..ad6cc2f4c86a64d00902ddeb264a1548b78f5be8 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -5518,8 +5518,15 @@ Sema::getTemplateArgumentBindingsText(const TemplateParameterList *Params, } case TemplateArgument::Expression: { - assert(false && "No expressions in deduced template arguments!"); - Result += "<expression>"; + // FIXME: This is non-optimal, since we're regurgitating the + // expression we were given. + std::string Str; + { + llvm::raw_string_ostream OS(Str); + Args[I].getAsExpr()->printPretty(OS, Context, 0, + Context.PrintingPolicy); + } + Result += Str; break; } diff --git a/test/SemaTemplate/temp_arg_nontype.cpp b/test/SemaTemplate/temp_arg_nontype.cpp index 7b83ff91945d20558795d215aca93efda3f5b6dc..d351eb458838dc3e425323b3ac82c24a35426f83 100644 --- a/test/SemaTemplate/temp_arg_nontype.cpp +++ b/test/SemaTemplate/temp_arg_nontype.cpp @@ -193,3 +193,13 @@ namespace EntityReferenced { typedef X<int*, Y<int*>::f> x; // expected-note{{in instantiation of}} } } + +namespace PR6964 { + template <typename ,int, int = 9223372036854775807L > // expected-warning 2{{non-type template argument value '9223372036854775807' truncated to '-1' for template parameter of type 'int'}} \ + // expected-note 2{{template parameter is declared here}} + struct as_nview { }; + + template <typename Sequence, int I0> + struct as_nview<Sequence, I0> // expected-note{{while checking a default template argument used here}} + { }; +}