<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/72217>72217</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Useless, incorrect error message when failing to find viable unary `operator*`
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          davidstone
      </td>
    </tr>
</table>

<pre>
    Given the following invalid translation unit:

```cpp
struct a {
};
struct b {
};
void operator*(b) {
}

void g() {
        a x;
        *x;
}
```

clang emits the error message

```console
<source>:10:2: error: indirection requires pointer operand ('a' invalid)
   10 |         *x;
      | ^~
1 error generated.
Compiler returned: 1
```

https://godbolt.org/z/bbvs4qq6n

This doesn't tell me much about what went wrong, and it outright lies (you can say `*x` for types other than pointers). Compare that to the error message if the failing function is anything else:

```cpp
struct a {
};
struct b {
};
void f(b) {
}

void g() {
        a x;
        f(x);
}
```

And clang fails with

```console
<source>:10:2: error: no matching function for call to 'f'
   10 |         f(x);
      |         ^
<source>:5:6: note: candidate function not viable: no known conversion from 'a' to 'b' for 1st argument
    5 | void f(b) {
      |      ^ ~
1 error generated.
Compiler returned: 1
```

https://godbolt.org/z/WTMvWWTro
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8VcFy4zYM_Rr4glmPRFmSddDBm8Q99ZZOzpQISWwp0iEhe91Dv71DyU7sbLbTw7aZjC0DFPjewwMpQ9C9Jaoh_wr540pOPDhfK3nUKrCztGqcOte_6CNZ5IGwc8a4k7Y9anuURitkL20wkrWzOFnNkO0geYTk-lkky397OCyRwH5qGSVC-fWypnyE7Otdtvk8e3RaoTuQl-w8iB2IbQOiul98s_u8vgexvV-UVBK_vRWFpAKxu_n9VuOK_bZka6TtkUbNYVaEvHceRwpB9vQ5c2eDM9dc9hDc5FuC7AmyXZpAthOQ7ZY68UFbpT21s6CeX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