23-06-2022, 02:22 PM
Hi experts,
A15-4-4
provides this example (17-10):
The implementation of F1 is not provided.
I would assume that a matching implementation of F1() would be, e.g.
My questions:
1. Is my implementation of F1 above correct?
2. What should a compliant static analysis tool report, when F1 does not throw?
3. Shall a compliant AUTOSAR C++ checker tool here report a violation (error/warning/...) or is this kind of a hint or note?
4. What shall be reported for the operator()() of a lambda that does not throw and does not explicitly add noexcept (example: auto l = []() { return 42; })?
5. (Bonus question) will a similar check be added to the next version of MISRA C++?
A15-4-4
Quote:Rule A15-4-4 (required, implementation, automated)
A declaration of non-throwing function shall contain noexcept specification.
provides this example (17-10):
Code:
// ...
Code:
void F1(); // Compliant - f1, without noexcept specification, declares to throw
// exceptions implicitly
// ...
The implementation of F1 is not provided.
I would assume that a matching implementation of F1() would be, e.g.
Code:
void F1() {
// something ...
throw std::runtime_error{"problem"};
}
My questions:
1. Is my implementation of F1 above correct?
2. What should a compliant static analysis tool report, when F1 does not throw?
3. Shall a compliant AUTOSAR C++ checker tool here report a violation (error/warning/...) or is this kind of a hint or note?
4. What shall be reported for the operator()() of a lambda that does not throw and does not explicitly add noexcept (example: auto l = []() { return 42; })?
5. (Bonus question) will a similar check be added to the next version of MISRA C++?