I have the following code:
int *&F(int *x) {
int **p = &x;
return *p;
}
int main() {
int A[] = {0, 1, 2, 3, 4}, *y = A + 2, *&q = F(y);
cout << *q << ' ' << *y << endl;
}
Now, i can see that we are returning the reference of x
, but neither clang nor Clion (using clang-tidy) is generating warning for this code. Is this a problem for the static analysis that is too hard to follow a pointer and so to know that is pointing to or this is not returning a dangling reference?