It turns out that we *can* end up having to display template argument

bindings when the template argument is still an expression; it happens
while checking the template arguments of a class template partial
specializations. Fixes PR6964.

llvm-svn: 102595
This commit is contained in:
Douglas Gregor 2010-04-29 04:55:13 +00:00
parent b0a0a26df1
commit 33dcc2e34d
2 changed files with 19 additions and 2 deletions

View File

@ -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;
}

View File

@ -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}}
{ };
}