MISRAC++2023-8.2.11 (C++ only)
In this section:
Synopsis
(Required) An argument passed via ellipsis shall have an appropriate type
Enabled by default
Yes
Severity/Certainty
High/Medium

Full description
Ellipsis arguments shall not be of type class if it the class is not trivial. A trivial class has no virtual members and no non trivial destructor, copy or move operators.
Coding standards
This check does not correspond to any coding standard rules.
Code examples
The following code example fails the check and will give a warning:
void foo(int, ...);
struct S {
int i;
virtual int get_val() { return i; };
};
void example(S& s) {
foo(2, 1.0, s); // Non-compliant
}
The following code example passes the check and will not give a warning about this issue:
struct S {
int i;
virtual int get_val() { return i; };
};
void foo(int, const S&, ...);
void example(S& s) {
foo(2, s, 1.0); // Compliant
}