annotate clang/test/Misc/integer-literal-printing.cpp @ 207:2e18cbf3894f

LLVM12
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Jun 2021 06:07:14 +0900
parents 1d019706d866
children c4bab56944e8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 %s -fsyntax-only -verify -std=c++11
anatofuz
parents:
diff changeset
2
anatofuz
parents:
diff changeset
3 // PR11179
anatofuz
parents:
diff changeset
4 template <short T> class Type1 {};
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
5 template <short T> void Function1(Type1<T>& x) {} // expected-note{{candidate function [with T = -42] not viable: expects an lvalue for 1st argument}}
150
anatofuz
parents:
diff changeset
6
anatofuz
parents:
diff changeset
7 template <unsigned short T> class Type2 {};
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
8 template <unsigned short T> void Function2(Type2<T>& x) {} // expected-note{{candidate function [with T = 42] not viable: expects an lvalue for 1st argument}}
150
anatofuz
parents:
diff changeset
9
anatofuz
parents:
diff changeset
10 enum class boolTy : bool {
anatofuz
parents:
diff changeset
11 b = 0,
anatofuz
parents:
diff changeset
12 };
anatofuz
parents:
diff changeset
13
anatofuz
parents:
diff changeset
14 template <boolTy T> struct Type3Helper;
anatofuz
parents:
diff changeset
15 template <> struct Type3Helper<boolTy::b> { typedef boolTy Ty; };
anatofuz
parents:
diff changeset
16 template <boolTy T, typename Type3Helper<T>::Ty U> struct Type3 {};
anatofuz
parents:
diff changeset
17
anatofuz
parents:
diff changeset
18 // PR14386
anatofuz
parents:
diff changeset
19 enum class charTy : char {
anatofuz
parents:
diff changeset
20 c = 0,
anatofuz
parents:
diff changeset
21 };
anatofuz
parents:
diff changeset
22
anatofuz
parents:
diff changeset
23 template <charTy T> struct Type4Helper;
anatofuz
parents:
diff changeset
24 template <> struct Type4Helper<charTy::c> { typedef charTy Ty; };
anatofuz
parents:
diff changeset
25 template <charTy T, typename Type4Helper<T>::Ty U> struct Type4 {};
anatofuz
parents:
diff changeset
26
anatofuz
parents:
diff changeset
27 enum class scharTy : signed char {
anatofuz
parents:
diff changeset
28 c = 0,
anatofuz
parents:
diff changeset
29 };
anatofuz
parents:
diff changeset
30
anatofuz
parents:
diff changeset
31 template <scharTy T> struct Type5Helper;
anatofuz
parents:
diff changeset
32 template <> struct Type5Helper<scharTy::c> { typedef scharTy Ty; };
anatofuz
parents:
diff changeset
33 template <scharTy T, typename Type5Helper<T>::Ty U> struct Type5 {};
anatofuz
parents:
diff changeset
34
anatofuz
parents:
diff changeset
35 enum class ucharTy : unsigned char {
anatofuz
parents:
diff changeset
36 c = 0,
anatofuz
parents:
diff changeset
37 };
anatofuz
parents:
diff changeset
38
anatofuz
parents:
diff changeset
39 template <ucharTy T> struct Type6Helper;
anatofuz
parents:
diff changeset
40 template <> struct Type6Helper<ucharTy::c> { typedef ucharTy Ty; };
anatofuz
parents:
diff changeset
41 template <ucharTy T, typename Type6Helper<T>::Ty U> struct Type6 {};
anatofuz
parents:
diff changeset
42
anatofuz
parents:
diff changeset
43 enum class wcharTy : wchar_t {
anatofuz
parents:
diff changeset
44 c = 0,
anatofuz
parents:
diff changeset
45 };
anatofuz
parents:
diff changeset
46
anatofuz
parents:
diff changeset
47 template <wcharTy T> struct Type7Helper;
anatofuz
parents:
diff changeset
48 template <> struct Type7Helper<wcharTy::c> { typedef wcharTy Ty; };
anatofuz
parents:
diff changeset
49 template <wcharTy T, typename Type7Helper<T>::Ty U> struct Type7 {};
anatofuz
parents:
diff changeset
50
anatofuz
parents:
diff changeset
51 enum class char16Ty : char16_t {
anatofuz
parents:
diff changeset
52 c = 0,
anatofuz
parents:
diff changeset
53 };
anatofuz
parents:
diff changeset
54
anatofuz
parents:
diff changeset
55 template <char16Ty T> struct Type8Helper;
anatofuz
parents:
diff changeset
56 template <> struct Type8Helper<char16Ty::c> { typedef char16Ty Ty; };
anatofuz
parents:
diff changeset
57 template <char16Ty T, typename Type8Helper<T>::Ty U> struct Type8 {};
anatofuz
parents:
diff changeset
58
anatofuz
parents:
diff changeset
59 enum class char32Ty : char16_t {
anatofuz
parents:
diff changeset
60 c = 0,
anatofuz
parents:
diff changeset
61 };
anatofuz
parents:
diff changeset
62
anatofuz
parents:
diff changeset
63 template <char32Ty T> struct Type9Helper;
anatofuz
parents:
diff changeset
64 template <> struct Type9Helper<char32Ty::c> { typedef char32Ty Ty; };
anatofuz
parents:
diff changeset
65 template <char32Ty T, typename Type9Helper<T>::Ty U> struct Type9 {};
anatofuz
parents:
diff changeset
66
anatofuz
parents:
diff changeset
67 void Function() {
anatofuz
parents:
diff changeset
68 Function1(Type1<-42>()); // expected-error{{no matching function for call to 'Function1'}}
anatofuz
parents:
diff changeset
69 Function2(Type2<42>()); // expected-error{{no matching function for call to 'Function2'}}
anatofuz
parents:
diff changeset
70
anatofuz
parents:
diff changeset
71 struct Type3<boolTy::b, "3"> t3; // expected-error{{value of type 'const char [2]' is not implicitly convertible to 'typename Type3Helper<(boolTy)false>::Ty' (aka 'boolTy')}}
anatofuz
parents:
diff changeset
72
anatofuz
parents:
diff changeset
73 struct Type4<charTy::c, "4"> t4; // expected-error{{value of type 'const char [2]' is not implicitly convertible to 'typename Type4Helper<(charTy)'\x00'>::Ty' (aka 'charTy')}}
anatofuz
parents:
diff changeset
74 struct Type5<scharTy::c, "5"> t5; // expected-error{{value of type 'const char [2]' is not implicitly convertible to 'typename Type5Helper<(scharTy)'\x00'>::Ty' (aka 'scharTy')}}
anatofuz
parents:
diff changeset
75 struct Type6<ucharTy::c, "6"> t6; // expected-error{{value of type 'const char [2]' is not implicitly convertible to 'typename Type6Helper<(ucharTy)'\x00'>::Ty' (aka 'ucharTy')}}
anatofuz
parents:
diff changeset
76 struct Type7<wcharTy::c, "7"> t7; // expected-error{{value of type 'const char [2]' is not implicitly convertible to 'typename Type7Helper<(wcharTy)L'\x00'>::Ty' (aka 'wcharTy')}}
anatofuz
parents:
diff changeset
77 struct Type8<char16Ty::c, "8"> t8; // expected-error{{value of type 'const char [2]' is not implicitly convertible to 'typename Type8Helper<(char16Ty)u'\x00'>::Ty' (aka 'char16Ty')}}
anatofuz
parents:
diff changeset
78 struct Type9<char32Ty::c, "9"> t9; // expected-error{{value of type 'const char [2]' is not implicitly convertible to 'typename Type9Helper<(char32Ty)u'\x00'>::Ty' (aka 'char32Ty')}}
anatofuz
parents:
diff changeset
79 }