Index: clang/lib/AST/TemplateBase.cpp =================================================================== --- clang/lib/AST/TemplateBase.cpp +++ clang/lib/AST/TemplateBase.cpp @@ -76,13 +76,32 @@ Out.write_escaped(StringRef(&Ch, 1), /*UseHexEscapes=*/ true); Out << "'"; } else { - Out << Val; if (T->isBuiltinType()) { - if (Val.isUnsigned()) - Out << "U"; - if (Val.getBitWidth() == 64) - Out << "LL"; - } + switch (cast(T)->getKind()) { + case BuiltinType::ULongLong: + Out << Val << "ULL"; + break; + case BuiltinType::LongLong: + Out << Val << "LL"; + break; + case BuiltinType::ULong: + Out << Val << "UL"; + break; + case BuiltinType::Long: + Out << Val << "L"; + break; + case BuiltinType::Int: + Out << Val; + break; + default: + if (T->isUnsignedIntegerType()) + Out << Val << "U"; + else + Out << "(" << T->getCanonicalTypeInternal().getAsString(Policy) << ")" + << Val; + } + } else + Out << Val; } } Index: clang/test/CXX/dcl.decl/dcl.decomp/p3.cpp =================================================================== --- clang/test/CXX/dcl.decl/dcl.decomp/p3.cpp +++ clang/test/CXX/dcl.decl/dcl.decomp/p3.cpp @@ -45,13 +45,13 @@ namespace std { template struct tuple_element; } // expected-note 2{{here}} void no_tuple_element_2() { - auto [a0, a1, a2] = A(); // expected-error {{implicit instantiation of undefined template 'std::tuple_element<0ULL, A>'}} expected-note {{in implicit}} + auto [a0, a1, a2] = A(); // expected-error {{implicit instantiation of undefined template 'std::tuple_element<0UL, A>'}} expected-note {{in implicit}} } template<> struct std::tuple_element<0, A> { typedef float type; }; void no_tuple_element_3() { - auto [a0, a1, a2] = A(); // expected-error {{implicit instantiation of undefined template 'std::tuple_element<1ULL, A>'}} expected-note {{in implicit}} + auto [a0, a1, a2] = A(); // expected-error {{implicit instantiation of undefined template 'std::tuple_element<1UL, A>'}} expected-note {{in implicit}} } template<> struct std::tuple_element<1, A> { typedef float &type; }; Index: clang/test/Misc/integer-literal-printing.cpp =================================================================== --- clang/test/Misc/integer-literal-printing.cpp +++ clang/test/Misc/integer-literal-printing.cpp @@ -2,7 +2,7 @@ // PR11179 template class Type1 {}; -template void Function1(Type1& x) {} // expected-note{{candidate function [with T = -42] not viable: expects an l-value for 1st argument}} +template void Function1(Type1& x) {} // expected-note{{candidate function [with T = (short)-42] not viable: expects an l-value for 1st argument}} template class Type2 {}; template void Function2(Type2& x) {} // expected-note{{candidate function [with T = 42U] not viable: expects an l-value for 1st argument}} Index: clang/test/SemaCXX/builtin-align-cxx.cpp =================================================================== --- clang/test/SemaCXX/builtin-align-cxx.cpp +++ clang/test/SemaCXX/builtin-align-cxx.cpp @@ -31,10 +31,10 @@ void test() { test_templated_arguments(); // fine test_templated_arguments(); - // expected-note@-1{{in instantiation of function template specialization 'test_templated_arguments'}} + // expected-note@-1{{in instantiation of function template specialization 'test_templated_arguments'}} // expected-note@-2{{forward declaration of 'fwddecl'}} test_templated_arguments(); // invalid alignment value - // expected-note@-1{{in instantiation of function template specialization 'test_templated_arguments'}} + // expected-note@-1{{in instantiation of function template specialization 'test_templated_arguments'}} } template Index: clang/test/SemaTemplate/address_space-dependent.cpp =================================================================== --- clang/test/SemaTemplate/address_space-dependent.cpp +++ clang/test/SemaTemplate/address_space-dependent.cpp @@ -102,7 +102,7 @@ HasASTemplateFields<1> HASTF; neg<-1>(); // expected-note {{in instantiation of function template specialization 'neg<-1>' requested here}} correct<0x7FFFF3>(); - tooBig<8388650>(); // expected-note {{in instantiation of function template specialization 'tooBig<8388650LL>' requested here}} + tooBig<8388650>(); // expected-note {{in instantiation of function template specialization 'tooBig<8388650L>' requested here}} __attribute__((address_space(1))) char *x; __attribute__((address_space(2))) char *y;