This caused by the gcc extension. When using "arg ? arg : new Foo()" it is handled correctly.
Is this considered a bug or should we stop using this gcc extension?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
On a somewhat related subject. I also found an: " AST broken, ternary operator missing operand(s) internalAstError" in some crazy code in my project. Maybe it's also gone with HEAD :)
Example:
Leads to:
Version: 2.6
This caused by the gcc extension. When using "arg ? arg : new Foo()" it is handled correctly.
Is this considered a bug or should we stop using this gcc extension?
I consider it a bug. Thanks!
I can reproduce the false positive with cppcheck-2.6 but not with cppcheck HEAD.
Thanks!
On a somewhat related subject. I also found an: " AST broken, ternary operator missing operand(s) internalAstError" in some crazy code in my project. Maybe it's also gone with HEAD :)
Seems to be the combination of deref and delete. Similar Problems:
No Problem:
Tikcet is here: https://trac.cppcheck.net/ticket/10662