Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions change_notes/2024-12-10-udpate-a7-1-1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- `A7-1-1` - `DeclarationUnmodifiedObjectMissingConstSpecifier.ql`:
- Exclude rvalue references.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ where
not exists(LambdaExpression lc | lc.getACapture().getField() = v) and
not v.isFromUninstantiatedTemplate(_) and
not v.isCompilerGenerated() and
not v.getType() instanceof RValueReferenceType and
//if the instantiation is not constexpr but the template is, still exclude it as a candidate
not exists(TemplateVariable b | b.getAnInstantiation() = v and b.isConstexpr())
select v, "Non-constant variable " + v.getName() + cond + " and is not modified."
14 changes: 13 additions & 1 deletion cpp/autosar/test/rules/A7-1-1/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,16 @@ template <bool... Args> extern constexpr bool recurse_var = true; // COMPLIANT
template <bool B1, bool... Args>
extern constexpr bool recurse_var<B1, Args...> = B1 &&recurse_var<Args...>;

void fp_621() { recurse_var<true, true, true>; }
void fp_621() { recurse_var<true, true, true>; }

#include <utility>

void variadic_forwarding() {}

template <typename T, typename... Args>
void variadic_forwarding(T &&first, Args &&...rest) {
first;
variadic_forwarding(std::forward<Args>(rest)...);
}

int test_variadic_forwarding() { variadic_forwarding(1, 1.1, "a"); }
Loading