Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude rvalue references from const in AUTOSAR rule 7-1-1. #814

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
14 changes: 13 additions & 1 deletion cpp/autosar/test/rules/A7-1-1/test.cpp
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I verified the test failed without the change in the previous commit due to

+| test.cpp:93:47:93:50 | rest | Non-constant variable rest points to an object and is not modified. |

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>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added all at the end of the file to minimize updates to the expected files due to line numbers. But not sure if due to (auto) formatting rules or else it would be preferable otherwise.


void variadic_forwarding() {}

template <typename T, typename... Args>
void variadic_forwarding(T &&first, Args &&...rest) {
fjatWbyT marked this conversation as resolved.
Show resolved Hide resolved
first;
variadic_forwarding(std::forward<Args>(rest)...);
}

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