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

    <tr>
        <th>Summary</th>
        <td>
            Clang produces unhelpful diagnostic message
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:diagnostics
      </td>
    </tr>

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

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

<pre>
    Consider the following [example](https://godbolt.org/z/xbqb3cosz) taken from [CWG1397](https://cplusplus.github.io/CWG/issues/1397.html):
```cpp
struct A {       
  void *p = A{};
  operator void*() const { return nullptr; }
};
```
ToT Clang issues the following (in C++14 mode and later):
```
<source>:2:15: error: default member initializer for 'p' needed within definition of enclosing class 'A' outside of member functions
  void *p = A{};
              ^
<source>:2:9: note: default member initializer declared here
  void *p = A{};
```
It describes what's happening, albeit in not too accessible phrasing IMO, but it fails to convey what's bad about it, leaving user without solid clue how to fix their code. I find [previous phrasing](https://github.com/llvm/llvm-project/commit/8dbc6b26171167b8ddf66a5f4b6d6fb9baf28336) of this diagnostic more clear for this particular case. 

To add to confusion, in C++11 mode an additional note is issued, and a slightly different line numbers are reported, as can be seen on [Compiler Explorer](https://godbolt.org/z/xbqb3cosz).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVU2P2zYQ_TX0ZVDDIm1JPugge9dBDkUvAXLmx0hiS3FUfuxu8usLSvvVYIsmgg1b5szzzJv3RjJGO3rEjp0u7HS3kzlNFLp7b6xzbqfIfOuu5KM1GCBNCAM5R4_Wj8BOF3yS8-KQne4Yb6eUlshEz_iN8dtIRpFLewoj47fvjN-e1N9KaIrfGT9Dkn-hhyHQXHCuXz9V4tx8hKMXl2N570ebpqz2lhi_Xb9-YvxmY8wYGb-V5P2UZsf4uWQe7tihZ_Vhe-ll2X6JKWSdoAfWXGC7tgOAB7IGGO8XYOIOetZcWH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