xref: /llvm-project/clang/test/Misc/integer-literal-printing.cpp (revision 8b626ba6debca8648eb2f6a3cc679cc12597c9c9)
1 // RUN: %clang_cc1 %s -fsyntax-only -verify
2 
3 // PR11179
4 template <short T> class Type1 {};
5 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;}}
6 
7 template <unsigned short T> class Type2 {};
8 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;}}
9 
10 template <__int128_t T> class Type3 {};
11 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;}}
12 
13 template <__uint128_t T> class Type4 {};
14 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;}}
15 
16 void Function() {
17   Function1(Type1<-42>()); // expected-error{{no matching function for call to 'Function1'}}
18   Function2(Type2<42>()); // expected-error{{no matching function for call to 'Function2'}}
19   Function3(Type3<-42>()); // expected-error{{no matching function for call to 'Function3'}}
20   Function4(Type4<42>()); // expected-error{{no matching function for call to 'Function4'}}
21 }
22