@@ -33,33 +33,33 @@ template <typename T, T y> class C4 {
3333};
3434
3535/* 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 {
3737public:
38- C9 () : x(y) {}
38+ C5 () : x(y) {}
3939
4040private:
4141 std::uint8_t x;
4242};
4343
44- template <typename T, T y> class C10 {
44+ template <typename T, T y> class C6 {
4545public:
46- C10 () : x(y) {}
46+ C6 () : x(y) {}
4747
4848private:
4949 std::int8_t x;
5050};
5151
52- template <typename T, T y> class C11 {
52+ template <typename T, T y> class C7 {
5353public:
54- C11 () : x(y) {}
54+ C7 () : x(y) {}
5555
5656private:
5757 std::uint8_t x;
5858};
5959
60- template <typename T, T y> class C12 {
60+ template <typename T, T y> class C8 {
6161public:
62- C12 () : x(y) {}
62+ C8 () : x(y) {}
6363
6464private:
6565 std::int8_t x;
@@ -87,33 +87,33 @@ template <typename T> void f14(T x) { std::int8_t y = x; }
8787template <typename T> void f15 (T x) { std::int8_t y = x; }
8888template <typename T> void f16 (T x) { std::int8_t y = x; }
8989
90- template <typename T> class C5 {
90+ template <typename T> class C9 {
9191public:
92- C5 (T y) : x(y) {}
92+ C9 (T y) : x(y) {}
9393
9494private:
9595 unsigned char x;
9696};
9797
98- template <typename T> class C6 {
98+ template <typename T> class C10 {
9999public:
100- C6 (T y) : x(y) {}
100+ C10 (T y) : x(y) {}
101101
102102private:
103103 signed char x;
104104};
105105
106- template <typename T> class C7 {
106+ template <typename T> class C11 {
107107public:
108- C7 (T y) : x(y) {}
108+ C11 (T y) : x(y) {}
109109
110110private:
111111 signed char x;
112112};
113113
114- template <typename T> class C8 {
114+ template <typename T> class C12 {
115115public:
116- C8 (T y) : x(y) {}
116+ C12 (T y) : x(y) {}
117117
118118private:
119119 signed char x;
@@ -200,27 +200,27 @@ int main() {
200200 // member through a template
201201
202202 /* 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
204204 // member through a template
205205
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
207207 // member through a template
208208
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
210210 // member through a template
211211
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
213213 // member through a template
214214
215215 /* ========== 1-3. Assigning a char to a char through a pointer ========== */
216216
217217 unsigned char x9 = 1 ;
218218 unsigned char *y9 = &x9;
219- signed char z1 =
219+ unsigned char z1 =
220220 *y9; // COMPLIANT: unsigned char assigned to a *&unsigned char
221221
222- unsigned char x10 = 1 ;
223- unsigned char *y10 = &x10;
222+ signed char x10 = 1 ;
223+ signed char *y10 = &x10;
224224 signed char z2 = *y10; // COMPLIANT: signed char assigned to an *&signed char
225225
226226 char x11 = 1 ;
@@ -236,11 +236,11 @@ int main() {
236236 /* Twin cases with std::uint8_t and std::int8_t */
237237 std::uint8_t x13 = 1 ;
238238 std::uint8_t *y13 = &x13;
239- std::int8_t z5 =
239+ std::uint8_t z5 =
240240 *y13; // COMPLIANT: std::uint8_t assigned to a *&std::uint8_t
241241
242- std::uint8_t x14 = 1 ;
243- std::uint8_t *y14 = &x14;
242+ std::int8_t x14 = 1 ;
243+ std::int8_t *y14 = &x14;
244244 std::int8_t z6 = *y14; // COMPLIANT: std::int8_t assigned to an *&std::int8_t
245245
246246 char x15 = 1 ;
@@ -295,11 +295,11 @@ int main() {
295295 // through a template
296296
297297 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
299299 // through a template
300300
301301 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
303303 // a template
304304
305305 /* Twin cases with std::uint8_t and std::int8_t */
@@ -312,31 +312,31 @@ int main() {
312312 // through a template
313313
314314 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
316316 // through a template
317317
318318 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
320320 // a template
321321
322322 /* ========== 2-3. Passing a char argument to a char parameter through a
323323 * template ========== */
324324
325325 unsigned char a17 = 1 ;
326- C5 <unsigned char > c5 (
326+ C9 <unsigned char > c9 (
327327 a17); // COMPLIANT: unsigned char arg passed to an unsigned char parameter
328328 // of a constructor through a template
329329
330330 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
332332 // char parameter of a constructor through a template
333333
334334 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
336336 // parameter of a constructor through a template
337337
338338 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
340340 // parameter of a constructor through a template
341341
342342 /* Twin cases with std::uint8_t and std::int8_t */
@@ -350,7 +350,7 @@ int main() {
350350 // parameter of a constructor through a template
351351
352352 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
354354 // parameter of a constructor through a template
355355
356356 char a24 = ' a' ;
0 commit comments