Skip to content

Commit fbc9cee

Browse files
committed
M14-6-1: Extra test cases for non-dependent base types
The rule specifically only refers to dependent base types of class templates.
1 parent a1f760f commit fbc9cee

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

cpp/autosar/test/rules/M14-6-1/test.cpp

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,35 @@ void f() {
3535
A<int> a;
3636
a.m1();
3737
a.m2();
38-
}
38+
}
39+
40+
class D {
41+
public:
42+
typedef int TYPE;
43+
void g();
44+
void g(int x);
45+
static void sg();
46+
static void sg(int x);
47+
int m;
48+
};
49+
50+
class C : D {
51+
public:
52+
void m1() {
53+
m = 0; // COMPLIANT - does not apply to non-class templates
54+
g(); // COMPLIANT - does not apply to non-class templates
55+
sg(); // COMPLIANT - does not apply to non-class templates
56+
TYPE t = 0; // COMPLIANT - does not apply to non-class templates
57+
// void (*p)() = &g; // NON_COMPILABLE
58+
}
59+
};
60+
61+
template <typename t> class E : D {
62+
public:
63+
void m1() {
64+
m = 0; // COMPLIANT - does not apply to non dependent base types
65+
g(); // COMPLIANT - does not apply to non dependent base types
66+
TYPE t = 0; // COMPLIANT - does not apply to non dependent base types
67+
void (*p)() = &g; // COMPLIANT - does not apply to non dependent base types
68+
}
69+
};

0 commit comments

Comments
 (0)