Hello, We ran into a corner-case false-positive syntaxError I'd like to report. It is similar to this which was fixed long ago.
In this corner-case, using the override keyword causes the false positive.
override
struct base { virtual ~base() = default; virtual void foo() try {} catch (...) {}; }; struct special : base { void foo() override // This override causes the try on the next line to false fail. try {} catch (...) {} }; int main() { special s; s.foo(); return 0; }
I am testing with cppcheck 2.22.0.
Here is the exact error: syntax error: keyword 'try' is not allowed in class/struct/union/enum scope [syntaxError]
syntax error: keyword 'try' is not allowed in class/struct/union/enum scope [syntaxError]
I also should mention that cppcheck 2.19.0 did not have this false positive.
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/15126
Log in to post a comment.
Hello,
We ran into a corner-case false-positive syntaxError I'd like to report. It is similar to this which was fixed long ago.
In this corner-case, using the
overridekeyword causes the false positive.I am testing with cppcheck 2.22.0.
Here is the exact error:
syntax error: keyword 'try' is not allowed in class/struct/union/enum scope [syntaxError]I also should mention that cppcheck 2.19.0 did not have this false positive.
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/15126