Skip to content

Commit 1cc399b

Browse files
committed
Augment test.cpp
1 parent f8c9158 commit 1cc399b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

cpp/autosar/test/rules/A5-2-6/test.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,20 @@ void f2(int p1, int p2) {
1515
if ((p1 > 0) || (p2 > 0)) { // COMPLIANT
1616
f1();
1717
}
18+
19+
struct Sample {
20+
int x;
21+
} sample;
22+
23+
if ((p1 > 0 ||
24+
sample.x)) { // COMPLIANT: struct member accessors (.) are excluded
25+
f1();
26+
}
27+
28+
Sample *sample_ptr = &sample;
29+
30+
if ((p1 > 0 || sample_ptr->x)) { // COMPLIANT: struct member accessors with
31+
// dereference (->) are excluded
32+
f1();
33+
}
1834
}

0 commit comments

Comments
 (0)