summaryrefslogtreecommitdiffstats
path: root/clang/test/Misc/integer-literal-printing.cpp
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2011-11-07 18:40:31 +0000
committerRichard Trieu <rtrieu@google.com>2011-11-07 18:40:31 +0000
commit8b626ba6debca8648eb2f6a3cc679cc12597c9c9 (patch)
tree012a64481393b4c145932e313a5316898bdb86b9 /clang/test/Misc/integer-literal-printing.cpp
parente80d4f228c8d0d42cd9a85d461f01d96c14f4137 (diff)
downloadbcm5719-llvm-8b626ba6debca8648eb2f6a3cc679cc12597c9c9.tar.gz
bcm5719-llvm-8b626ba6debca8648eb2f6a3cc679cc12597c9c9.zip
Add support for printing integer literals of type short, unsigned short,
__int128_t and __uint128_t. Short and unsigned short integer literals support is only to work around a crasher as reported in PR11179 and will be removed once Clang no longer builds short integer literals. llvm-svn: 143977
Diffstat (limited to 'clang/test/Misc/integer-literal-printing.cpp')
-rw-r--r--clang/test/Misc/integer-literal-printing.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/clang/test/Misc/integer-literal-printing.cpp b/clang/test/Misc/integer-literal-printing.cpp
new file mode 100644
index 00000000000..39c7090cae5
--- /dev/null
+++ b/clang/test/Misc/integer-literal-printing.cpp
@@ -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<-42i128> &' 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<42Ui128> &' 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'}}
+}
OpenPOWER on IntegriCloud