To me this looks like a false positive:
int *ptr; void foo(int arr[]) { ptr = &arr[2]; }
cppcheck_false_positive.cpp:4:5: error: Non-local variable 'ptr' will use pointer to local variable 'arr'. [danglingLifetime] ptr = &arr[2]; ^
I agree it's a false positive. thanks for reporting it, a ticket will be created asap...
I created this ticket: https://trac.cppcheck.net/ticket/9453
Log in to post a comment.
To me this looks like a false positive:
cppcheck_false_positive.cpp:4:5: error: Non-local variable 'ptr' will use pointer to local variable 'arr'. [danglingLifetime]
ptr = &arr[2];
^
I agree it's a false positive. thanks for reporting it, a ticket will be created asap...
I created this ticket: https://trac.cppcheck.net/ticket/9453