Skip to content

Commit 53c7483

Browse files
committed
M3-2-1: Add failing test case for member variables
1 parent cda9606 commit 53c7483

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

cpp/autosar/test/rules/M3-2-1/test_declarations_of_an_object_shall_have_compatible_types_unit1.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,13 @@ template <class T> constexpr T number_one = T(1); // COMPLIANT
2323

2424
int test() { return number_one<int>; }
2525

26-
long test2() { return number_one<long>; }
26+
long test2() { return number_one<long>; }
27+
28+
template <class T> class ClassB {
29+
private:
30+
T mA; // Should be ignored, as not an object
31+
double mB; // Should be ignored, as not an object
32+
};
33+
34+
void test3() { ClassB<int> b; }
35+
void test4() { ClassB<long> b; }

cpp/autosar/test/rules/M3-2-1/test_declarations_of_an_object_shall_have_compatible_types_unit2.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,12 @@ extern long a2; // NON_COMPLIANT
2626
extern int a9[100]; // COMPLIANT
2727
LI a10[100]; // COMPLIANT
2828
extern int a11[101]; // NON_COMPLIANT - different sizes
29+
30+
template <class T> class ClassB {
31+
private:
32+
T mA; // Should be ignored, as not an object
33+
int mB; // Should be ignored, as not an object
34+
};
35+
36+
void testb_1() { ClassB<int> b; }
37+
void testb_2() { ClassB<long> b; }

0 commit comments

Comments
 (0)