diff --git a/clang/lib/AST/TypePrinter.cpp b/clang/lib/AST/TypePrinter.cpp --- a/clang/lib/AST/TypePrinter.cpp +++ b/clang/lib/AST/TypePrinter.cpp @@ -2025,6 +2025,16 @@ } } + if (Arg.getKind() == TemplateArgument::Integral && + Pattern.getKind() == TemplateArgument::Expression) { + Expr const *expr = Pattern.getAsExpr(); + + if (!expr->isValueDependent() && expr->isIntegerConstantExpr(Ctx)) { + return llvm::APSInt::isSameValue(expr->EvaluateKnownConstInt(Ctx), + Arg.getAsIntegral()); + } + } + if (Arg.getKind() != Pattern.getKind()) return false; diff --git a/clang/test/CXX/temp/temp.arg/temp.arg.template/p3-0x.cpp b/clang/test/CXX/temp/temp.arg/temp.arg.template/p3-0x.cpp --- a/clang/test/CXX/temp/temp.arg/temp.arg.template/p3-0x.cpp +++ b/clang/test/CXX/temp/temp.arg/temp.arg.template/p3-0x.cpp @@ -15,7 +15,7 @@ eval> eB; eval> eC; // expected-error{{implicit instantiation of undefined template 'eval>'}} eval> eD; // expected-error{{implicit instantiation of undefined template 'eval>'}} -eval> eE; // expected-error{{implicit instantiation of undefined template 'eval>}} +eval> eE; // expected-error{{implicit instantiation of undefined template 'eval>}} template