Issue 166835
Summary Enhancement: add a warning for possibly unintended pointer overload calls (e.g. calling `foo(int*)` instead of `foo(int)`)
Labels new issue
Assignees
Reporter ahatanak
    The warning could have prevented the bug fixed in https://github.com/llvm/llvm-project/pull/165056.

This is a proposal for a new diagnostic that could detect possibly unintended calls to pointer overloads when a value overload also exists.

Consider the following code:

```
void foo(int);
void foo(int*);

void test() {
  int x = 123;
  int *p = &x;

  foo(p);  // probably intended: foo(*p);
}
```

This code is valid and unambiguous. However, in some situations, this pattern reflects a common user mistake: the programmer meant to dereference the pointer but forgot the `*`.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to