Update Clang to not complain when printing IntegerLiterals with type short,
unsigned short, __int128_t, or __uint128_t.  This will fix PR11179.

PR:
http://llvm.org/bugs/show_bug.cgi?id=11179

Patch also located at:
http://codereview.appspot.com/5309045/
Index: test/Misc/integer-literal-printing.cpp
===================================================================
--- test/Misc/integer-literal-printing.cpp	(revision 0)
+++ test/Misc/integer-literal-printing.cpp	(revision 0)
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify
+
+// PR11179
+template <short T> class Type1 {};
+template <short T> void Function1(Type1<T>& x) {} // expected-note{{candidate function [with T = 42] not viable: no known conversion from 'Type1<42>' to 'Type1<42> &' for 1st argument;}}
+
+template <unsigned short T> class Type2 {};
+template <unsigned short T> void Function2(Type2<T>& x) {} // expected-note{{candidate function [with T = 42] not viable: no known conversion from 'Type2<42>' to 'Type2<42> &' for 1st argument;}}
+
+template <__int128_t T> class Type3 {};
+template <__int128_t T> void Function3(Type3<T>& x) {} // expected-note{{candidate function [with T = 42] not viable: no known conversion from 'Type3<42>' to 'Type3<42> &' for 1st argument;}}
+
+template <__uint128_t T> class Type4 {};
+template <__uint128_t T> void Function4(Type4<T>& x) {} // expected-note{{candidate function [with T = 42] not viable: no known conversion from 'Type4<42>' to 'Type4<42> &' for 1st argument;}}
+
+void Function() {
+  Function1(Type1<42>()); // expected-error{{no matching function for call to 'Function1'}}
+  Function2(Type2<42>()); // expected-error{{no matching function for call to 'Function2'}}
+  Function3(Type3<42>()); // expected-error{{no matching function for call to 'Function3'}}
+  Function4(Type4<42>()); // expected-error{{no matching function for call to 'Function4'}}
+}
Index: lib/AST/StmtPrinter.cpp
===================================================================
--- lib/AST/StmtPrinter.cpp	(revision 142606)
+++ lib/AST/StmtPrinter.cpp	(working copy)
@@ -659,6 +659,10 @@
   // Emit suffixes.  Integer literals are always a builtin integer type.
   switch (Node->getType()->getAs<BuiltinType>()->getKind()) {
   default: llvm_unreachable("Unexpected type for integer literal!");
+  case BuiltinType::Int128:
+  case BuiltinType::UInt128:
+  case BuiltinType::Short:
+  case BuiltinType::UShort:
   case BuiltinType::Int:       break; // no suffix.
   case BuiltinType::UInt:      OS << 'U'; break;
   case BuiltinType::Long:      OS << 'L'; break;
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to