Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f462697

Browse filesBrowse files
committed
feat(a14-5-2): do not consider type members declared with using aliases.
1 parent 7736c34 commit f462697
Copy full SHA for f462697

File tree

Expand file treeCollapse file tree

3 files changed

+6
-6
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+6
-6
lines changed

‎cpp/autosar/src/rules/A14-5-2/NonTemplateMemberDefinedInTemplate.ql

Copy file name to clipboardExpand all lines: cpp/autosar/src/rules/A14-5-2/NonTemplateMemberDefinedInTemplate.ql
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,9 @@ where
167167
mf = c.getAMemberFunction() and not mf.isCompilerGenerated() and not exists(mf.getBlock())
168168
)
169169
)
170-
)
170+
) and
171+
// Omit using alias (cf. https://github.com/github/codeql-coding-standards/issues/739)
172+
not d instanceof UsingAliasTypedefType
171173
select d,
172174
"Member " + d.getName() + " template class does not use any of template arguments of its $@.",
173175
d.getDeclaringType(), "declaring type"

‎cpp/autosar/test/rules/A14-5-2/NonTemplateMemberDefinedInTemplate.expected

Copy file name to clipboardExpand all lines: cpp/autosar/test/rules/A14-5-2/NonTemplateMemberDefinedInTemplate.expected
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
| test.cpp:10:9:10:10 | T1 | Member T1 template class does not use any of template arguments of its $@. | test.cpp:6:29:6:30 | C1<T> | declaring type |
2-
| test.cpp:11:9:11:10 | T2 | Member T2 template class does not use any of template arguments of its $@. | test.cpp:6:29:6:30 | C1<T> | declaring type |
31
| test.cpp:28:31:28:33 | C12<N> | Member C12<N> template class does not use any of template arguments of its $@. | test.cpp:6:29:6:30 | C1<T> | declaring type |
42
| test.cpp:45:7:45:8 | a1 | Member a1 template class does not use any of template arguments of its $@. | test.cpp:37:31:37:33 | C22<N> | declaring type |
53
| test.cpp:46:9:46:10 | a2 | Member a2 template class does not use any of template arguments of its $@. | test.cpp:37:31:37:33 | C22<N> | declaring type |

‎cpp/autosar/test/rules/A14-5-2/test.cpp

Copy file name to clipboardExpand all lines: cpp/autosar/test/rules/A14-5-2/test.cpp
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ template <typename T> class C1 {
77
public:
88
enum E1 : T { e1, e2 }; // COMPLIANT
99

10-
using T1 = typename template_base<T>::type; // COMPLIANT[FALSE_POSITIVE]
11-
using T2 = typename template_base<int>::type; // NON_COMPLIANT
10+
using T1 = typename template_base<T>::type; // COMPLIANT
11+
using T2 = typename template_base<int>::type; // NON_COMPLIANT[FALSE_NEGATIVE]
1212

1313
class C11 { // COMPLIANT
1414
enum E2 {
@@ -156,4 +156,4 @@ template <J::Type t> class V {
156156
void f4() {
157157
V<J::Type::A> v;
158158
v.type();
159-
}
159+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.