Skip to content

Commit 5ce788f

Browse files
authored
Merge pull request #626 from knewbury01/knewbury01/fix-616
M9-3-3: exclude uninstantiated templates from static member function query
2 parents d7117e8 + 199ad0b commit 5ce788f

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- `M9-3-3` - `MemberFunctionStaticIfPossible.ql`:
2+
- Fixes #616. Exclude uninstantiated templates.

cpp/autosar/src/rules/M9-3-3/MemberFunctionStaticIfPossible.ql

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ class NonStaticMemberFunction extends MemberFunction {
3131
not this instanceof Constructor and
3232
not this instanceof Destructor and
3333
not this instanceof Operator and
34-
this.hasDefinition()
34+
this.hasDefinition() and
35+
not this.isFromUninstantiatedTemplate(_)
3536
}
3637
}
3738

cpp/autosar/test/rules/M9-3-3/test.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -214,4 +214,11 @@ void fp_reported_in_381() {
214214
Z4 z;
215215
int i = z.front();
216216
z.fill(i);
217-
}
217+
}
218+
219+
class ZZ {
220+
public:
221+
template <typename T>
222+
void fp_616(const T &val) {
223+
} // COMPLIANT - ignore uninstantiated templates for static also
224+
};

0 commit comments

Comments
 (0)