Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/clang/lib/AST/TemplateBase.cpp b/clang/lib/AST/TemplateBase.cpp
- index 0d2e54d8d9a..c2c07c6e8f0 100644
- --- a/clang/lib/AST/TemplateBase.cpp
- +++ b/clang/lib/AST/TemplateBase.cpp
- @@ -76,13 +76,20 @@ static void printIntegral(const TemplateArgument &TemplArg,
- 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";
- + if (T->isUnsignedIntegerType() && Val.getBitWidth() == 64)
- + Out << Val << "ULL";
- + else if (T->isSignedIntegerType() && Val.getBitWidth() == 64)
- + Out << Val << "LL";
- + else if (T->isUnsignedIntegerType())
- + Out << Val << "U";
- + else if (T->getCanonicalTypeInternal().getAsString(Policy) == "int")
- + Out << Val;
- + else
- + Out << "(" << T->getCanonicalTypeInternal().getAsString(Policy) << ")" << Val;
- }
- + else
- + Out << Val;
- }
- }
- diff --git a/clang/test/Misc/integer-literal-printing.cpp b/clang/test/Misc/integer-literal-printing.cpp
- index bd73a63f264..ba8427c56a3 100644
- --- a/clang/test/Misc/integer-literal-printing.cpp
- +++ b/clang/test/Misc/integer-literal-printing.cpp
- @@ -2,7 +2,7 @@
- // PR11179
- template <short T> class Type1 {};
- -template <short T> void Function1(Type1<T>& x) {} // expected-note{{candidate function [with T = -42] not viable: expects an l-value for 1st argument}}
- +template <short T> void Function1(Type1<T>& x) {} // expected-note{{candidate function [with T = (short)-42] not viable: expects an l-value for 1st argument}}
- template <unsigned short T> class Type2 {};
- template <unsigned short T> void Function2(Type2<T>& x) {} // expected-note{{candidate function [with T = 42U] not viable: expects an l-value for 1st argument}}
Add Comment
Please, Sign In to add comment