Skip to content

Commit 808b5fd

Browse files
committed
Fix cases
1. Change signed char / int8_t case to their opposites. 2. Assign a numeral to the unsigned char / signed char than a character.
1 parent fb54487 commit 808b5fd

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

cpp/autosar/test/rules/M5-0-12/test.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,13 @@ void f12(std::int8_t x) {}
7878

7979
template <typename T> void f5(T x) { unsigned char y = x; }
8080
template <typename T> void f6(T x) { signed char y = x; }
81-
template <typename T> void f7(T x) { signed char y = x; }
81+
template <typename T> void f7(T x) { unsigned char y = x; }
8282
template <typename T> void f8(T x) { signed char y = x; }
8383

8484
/* Twin template functions for std::uint8_t and std::int8_t */
8585
template <typename T> void f13(T x) { std::uint8_t y = x; }
8686
template <typename T> void f14(T x) { std::int8_t y = x; }
87-
template <typename T> void f15(T x) { std::int8_t y = x; }
87+
template <typename T> void f15(T x) { std::uint8_t y = x; }
8888
template <typename T> void f16(T x) { std::int8_t y = x; }
8989

9090
template <typename T> class C9 {
@@ -286,33 +286,33 @@ int main() {
286286
/* ===== 2-2. Passing char argument to a char parameter through a template
287287
* ===== */
288288

289-
unsigned char a9 = 'a';
289+
unsigned char a9 = 1;
290290
f5(a9); // COMPLIANT: unsigned char arg passed to an unsigned char parameter
291291
// through a template
292292

293-
signed char a10 = 'a';
293+
signed char a10 = 1;
294294
f6(a10); // COMPLIANT: signed char arg passed to a signed char parameter
295295
// through a template
296296

297297
char a11 = 'a';
298-
f7(a11); // NON-COMPLIANT: plain char arg passed to a signed char parameter
298+
f7(a11); // NON-COMPLIANT: plain char arg passed to an unsigned char parameter
299299
// through a template
300300

301301
char a12 = 'a';
302302
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 */
306-
std::uint8_t a13 = 'a';
306+
std::uint8_t a13 = 1;
307307
f13(a13); // COMPLIANT: std::uint8_t arg passed to a std::uint8_t parameter
308308
// through a template
309309

310-
std::int8_t a14 = 'a';
310+
std::int8_t a14 = 1;
311311
f14(a14); // COMPLIANT: std::int8_t arg passed to a std::int8_t parameter
312312
// through a template
313313

314314
char a15 = 'a';
315-
f15(a15); // NON-COMPLIANT: plain char arg passed to a std::int8_t parameter
315+
f15(a15); // NON-COMPLIANT: plain char arg passed to a std::uint8_t parameter
316316
// through a template
317317

318318
char a16 = 'a';

0 commit comments

Comments
 (0)