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

    <tr>
        <th>Summary</th>
        <td>
            Missing note about volatile read in constant expression
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            c++,
            clang:diagnostics
      </td>
    </tr>

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

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

<pre>
    While tinkering with CWG457 test, I came across the following inconsistency (https://godbolt.org/z/oerW3e35o):
```cpp
const int a = 1;
const volatile int b = 1;
struct S {
  static const int ay = a;
  static const int by = b;
  int az : a;
  int bz : b;
};
```
```
<source>:5:25: error: in-class initializer for static data member is not a constant expression
    5 |   static const int by = b;
      |                         ^
<source>:7:12: error: expression is not an integral constant expression
    7 |   int bz : b;
      |            ^
<source>:7:12: note: read of volatile-qualified type 'const volatile int' is not allowed in a constant expression
2 errors generated.
```
Per C++98, both contexts require integral constant expression, so we should emit the note in both cases.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVE1v4zYQ_TWjyyCGRFqWdNDBseOihwIFesiZksYSW5r0ckabTX59QTkf3tRIlxDErzfD94acMcx29EQtlPdQ7jMzyxRi--AH65zLujA8t4-TdYRi_T8UrR_xycqEu8ff1mWFQiygdvg79uZEaPoYmFEmwmNwLjwlvPV98GxZyPfPCKqeRM4MegvqAOowhqELTlYhjqAOL6AOgeKjJl0GUE2C5XvIt7DJL19_Pl9WkldB6wUNgt5jAfr-eud7cEYS9QTpPkFY4twL_oVQva4gshixPV75fV6szLvVDUx3wXRXmMX0BUFvfzJd0JflDzRU-4_xm8TbU73jMMeeQD-A3pagtyr9kGIMMQ2sv-udYUbrrVjj7AtFPIb4RnowYvBEp44iWkYfUuQWJcYL0o9zJGYb_BthxBKh2uGvqU7tgr7doHy4KaQCvS3UT0I-qLzz9OlYGqNxXzOuXjncDPZNkv_Pyweh1EcyA4bj-8O6-zYbZ4-WBpTnMyGo6r8vD1T1LiJlBA1o_VdxV5c4MI7kKRqhYXXzPfxJEXeg7kHdN3XKwS7IlNwK_RDGSN9mG-nrsKkdcsAnQp7C7Aakk5Ule5PkxPPi0zDxKhtaPTS6MRm1RVWopqnWmyab2rzeVHWui7rWxbHcbIpO1aqgmhQde5WbzLYqV-t8Xei81tW6WeXG5I3u6y7Pq2ZTbmCd08lYt3Lu-ykVgswyz9TW9SbXmTMdOV4qlFL9RTEoBWqX5s74EfR2sGb0gcX2nPbKfRbb5O2um0eGde4sC3_4FyuO2j8sc6pQi1rThfnq6pbLtv5W2LI5uvZTEbMyzd2qDydQh3TKa3d3juFv6gXUYZHEoA6Lqn8DAAD__1QBqkg">