Hi, using cppcheck 2.6. I can't remember seeing this before maybe it's an regression. Example:
#include <stdlib.h> struct Foo { char *foo; int len; }; int main(int argc, char *argv[]) { Foo bar; bar.foo = (typeof(bar.foo))calloc(bar.len, sizeof(*bar.foo)); bar.foo = (decltype(bar.foo))calloc(bar.len, sizeof(*bar.foo)); }
=>
test.c:9:23: error: Syntax Error: AST broken, 'bar' doesn't have a parent. [internalAstError] bar.foo = (typeof(bar.foo))calloc(bar.len, sizeof(*bar.foo));
Note that it works if using simple vars instead of the struct.
Thanks for reporting, this is probably covered by https://trac.cppcheck.net/ticket/10739 I have added your example to that ticket.
Log in to post a comment.
Hi,
using cppcheck 2.6. I can't remember seeing this before maybe it's an regression.
Example:
=>
Note that it works if using simple vars instead of the struct.
Thanks for reporting, this is probably covered by https://trac.cppcheck.net/ticket/10739
I have added your example to that ticket.