@@ -33,33 +33,33 @@ template <typename T, T y> class C4 {
33
33
};
34
34
35
35
/* Twin templates for std::uint8_t and std::int8_t */
36
- template <typename T, T y> class C9 {
36
+ template <typename T, T y> class C5 {
37
37
public:
38
- C9 () : x(y) {}
38
+ C5 () : x(y) {}
39
39
40
40
private:
41
41
std::uint8_t x;
42
42
};
43
43
44
- template <typename T, T y> class C10 {
44
+ template <typename T, T y> class C6 {
45
45
public:
46
- C10 () : x(y) {}
46
+ C6 () : x(y) {}
47
47
48
48
private:
49
49
std::int8_t x;
50
50
};
51
51
52
- template <typename T, T y> class C11 {
52
+ template <typename T, T y> class C7 {
53
53
public:
54
- C11 () : x(y) {}
54
+ C7 () : x(y) {}
55
55
56
56
private:
57
57
std::uint8_t x;
58
58
};
59
59
60
- template <typename T, T y> class C12 {
60
+ template <typename T, T y> class C8 {
61
61
public:
62
- C12 () : x(y) {}
62
+ C8 () : x(y) {}
63
63
64
64
private:
65
65
std::int8_t x;
@@ -87,33 +87,33 @@ template <typename T> void f14(T x) { std::int8_t y = x; }
87
87
template <typename T> void f15 (T x) { std::int8_t y = x; }
88
88
template <typename T> void f16 (T x) { std::int8_t y = x; }
89
89
90
- template <typename T> class C5 {
90
+ template <typename T> class C9 {
91
91
public:
92
- C5 (T y) : x(y) {}
92
+ C9 (T y) : x(y) {}
93
93
94
94
private:
95
95
unsigned char x;
96
96
};
97
97
98
- template <typename T> class C6 {
98
+ template <typename T> class C10 {
99
99
public:
100
- C6 (T y) : x(y) {}
100
+ C10 (T y) : x(y) {}
101
101
102
102
private:
103
103
signed char x;
104
104
};
105
105
106
- template <typename T> class C7 {
106
+ template <typename T> class C11 {
107
107
public:
108
- C7 (T y) : x(y) {}
108
+ C11 (T y) : x(y) {}
109
109
110
110
private:
111
111
signed char x;
112
112
};
113
113
114
- template <typename T> class C8 {
114
+ template <typename T> class C12 {
115
115
public:
116
- C8 (T y) : x(y) {}
116
+ C12 (T y) : x(y) {}
117
117
118
118
private:
119
119
signed char x;
@@ -200,27 +200,27 @@ int main() {
200
200
// member through a template
201
201
202
202
/* Twin cases with std::uint8_t and std::int8_t */
203
- C9 <std::uint8_t , 1 > c9 ; // COMPLIANT: std::uint8_t arg passed to a std::uint8_t
203
+ C5 <std::uint8_t , 1 > c5 ; // COMPLIANT: std::uint8_t arg passed to a std::uint8_t
204
204
// member through a template
205
205
206
- C10 <std::int8_t , 1 > c10 ; // COMPLIANT: std::int8_t arg passed to a std::int8_t
206
+ C6 <std::int8_t , 1 > c6 ; // COMPLIANT: std::int8_t arg passed to a std::int8_t
207
207
// member through a template
208
208
209
- C11 <char , ' x' > c11 ; // NON-COMPLIANT: plain char arg passed to a std::uint8_t
209
+ C7 <char , ' x' > c7 ; // NON-COMPLIANT: plain char arg passed to a std::uint8_t
210
210
// member through a template
211
211
212
- C12 <char , ' x' > c12 ; // NON-COMPLIANT: plain char arg passed to a std::int8_t
212
+ C8 <char , ' x' > c8 ; // NON-COMPLIANT: plain char arg passed to a std::int8_t
213
213
// member through a template
214
214
215
215
/* ========== 1-3. Assigning a char to a char through a pointer ========== */
216
216
217
217
unsigned char x9 = 1 ;
218
218
unsigned char *y9 = &x9;
219
- signed char z1 =
219
+ unsigned char z1 =
220
220
*y9; // COMPLIANT: unsigned char assigned to a *&unsigned char
221
221
222
- unsigned char x10 = 1 ;
223
- unsigned char *y10 = &x10;
222
+ signed char x10 = 1 ;
223
+ signed char *y10 = &x10;
224
224
signed char z2 = *y10; // COMPLIANT: signed char assigned to an *&signed char
225
225
226
226
char x11 = 1 ;
@@ -236,11 +236,11 @@ int main() {
236
236
/* Twin cases with std::uint8_t and std::int8_t */
237
237
std::uint8_t x13 = 1 ;
238
238
std::uint8_t *y13 = &x13;
239
- std::int8_t z5 =
239
+ std::uint8_t z5 =
240
240
*y13; // COMPLIANT: std::uint8_t assigned to a *&std::uint8_t
241
241
242
- std::uint8_t x14 = 1 ;
243
- std::uint8_t *y14 = &x14;
242
+ std::int8_t x14 = 1 ;
243
+ std::int8_t *y14 = &x14;
244
244
std::int8_t z6 = *y14; // COMPLIANT: std::int8_t assigned to an *&std::int8_t
245
245
246
246
char x15 = 1 ;
@@ -295,11 +295,11 @@ int main() {
295
295
// through a template
296
296
297
297
char a11 = ' a' ;
298
- f7 (a11); // NON-COMPLIANT: plain char arg passed to a unsigned char parameter
298
+ f7 (a11); // NON-COMPLIANT: plain char arg passed to a signed char parameter
299
299
// through a template
300
300
301
301
char a12 = ' a' ;
302
- f8 (a12); // COMPLIANT: plain char arg passed to a signed char parameter through
302
+ f8 (a12); // NON- COMPLIANT: plain char arg passed to a signed char parameter through
303
303
// a template
304
304
305
305
/* Twin cases with std::uint8_t and std::int8_t */
@@ -312,31 +312,31 @@ int main() {
312
312
// through a template
313
313
314
314
char a15 = ' a' ;
315
- f15 (a15); // NON-COMPLIANT: plain char arg passed to a std::uint8_t parameter
315
+ f15 (a15); // NON-COMPLIANT: plain char arg passed to a std::int8_t parameter
316
316
// through a template
317
317
318
318
char a16 = ' a' ;
319
- f16 (a16); // COMPLIANT: plain char arg passed to a std::int8_t parameter through
319
+ f16 (a16); // NON- COMPLIANT: plain char arg passed to a std::int8_t parameter through
320
320
// a template
321
321
322
322
/* ========== 2-3. Passing a char argument to a char parameter through a
323
323
* template ========== */
324
324
325
325
unsigned char a17 = 1 ;
326
- C5 <unsigned char > c5 (
326
+ C9 <unsigned char > c9 (
327
327
a17); // COMPLIANT: unsigned char arg passed to an unsigned char parameter
328
328
// of a constructor through a template
329
329
330
330
signed char a18 = 1 ;
331
- C6 <signed char > c6 (a18); // COMPLIANT: signed char arg passed to an signed
331
+ C10 <signed char > c10 (a18); // COMPLIANT: signed char arg passed to an signed
332
332
// char parameter of a constructor through a template
333
333
334
334
char a19 = ' a' ;
335
- C7 <char > c7 (a19); // NON-COMPLIANT: plain char arg passed to an unsigned char
335
+ C11 <char > c11 (a19); // NON-COMPLIANT: plain char arg passed to a signed char
336
336
// parameter of a constructor through a template
337
337
338
338
char a20 = ' a' ;
339
- C8 <char > c8 (a20); // NON-COMPLIANT: plain char arg passed to an signed char
339
+ C12 <char > c12 (a20); // NON-COMPLIANT: plain char arg passed to an signed char
340
340
// parameter of a constructor through a template
341
341
342
342
/* Twin cases with std::uint8_t and std::int8_t */
@@ -350,7 +350,7 @@ int main() {
350
350
// parameter of a constructor through a template
351
351
352
352
char a23 = ' a' ;
353
- C15<char > c15 (a23); // NON-COMPLIANT: plain char arg passed to a std::uint8_t
353
+ C15<char > c15 (a23); // NON-COMPLIANT: plain char arg passed to a std::int8_t
354
354
// parameter of a constructor through a template
355
355
356
356
char a24 = ' a' ;
0 commit comments