Skip to content

Commit

Permalink
M9-3-3: exclude uninstantiated templates from static query
Browse files Browse the repository at this point in the history
  • Loading branch information
knewbury01 committed Jun 19, 2024
1 parent f1e1f21 commit 199ad0b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions change_notes/2024-06-18-fix-fp-616-M9-3-3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- `M9-3-3` - `MemberFunctionStaticIfPossible.ql`:
- Fixes #616. Exclude uninstantiated templates.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ class NonStaticMemberFunction extends MemberFunction {
not this instanceof Constructor and
not this instanceof Destructor and
not this instanceof Operator and
this.hasDefinition()
this.hasDefinition() and
not this.isFromUninstantiatedTemplate(_)
}
}

Expand Down
9 changes: 8 additions & 1 deletion cpp/autosar/test/rules/M9-3-3/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,4 +214,11 @@ void fp_reported_in_381() {
Z4 z;
int i = z.front();
z.fill(i);
}
}

class ZZ {
public:
template <typename T>
void fp_616(const T &val) {
} // COMPLIANT - ignore uninstantiated templates for static also
};

0 comments on commit 199ad0b

Please sign in to comment.