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

    <tr>
        <th>Summary</th>
        <td>
            Using a constexpr value through a reference is not constexpr
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

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

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

<pre>
    The code below fails to compile with clang, works on gcc
```
#include <iostream>

template<int v>
struct Test {
    static constexpr int value = v;
};

int main() {
    Test<124> test;
    auto& test2 = test;

    if constexpr(test2.value > 3) {
        std::cout << "Hello, World!" << std::endl;
    }

    return 0;
}

```
```
$ clang++ --version
clang version 15.0.7
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
```

https://godbolt.org/z/vbbrWMYe7
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsk0uPuzYUxT_NZXOVyNg8woJFHoPaxV_dTDXqqjJwA26NHfmRSfvpK0gymaR_CRns87PP8bWR3qvBENWQ7yA_JDKG0br6t8EoaX4kre3_qd9Hws72hC1p-4lHqbTHYLGz00lpwk8VRuy0NAPwPX5a97dHa3DoOmAHYFso2O25drlQptOxJwSxV9YHR3IC8XaTlzbQdNIy0EyYgOcv2QcXu4Dv5ANCubsOIiL6IIPqsLPGB7qcHC7zpI6zzWFe4QZDeXh8L-1MTlIZ4Bvg1fOysxGIfcozEG8Ylt43WcZggReLwBejJ-QBquMjGvDNwq_v8d5Q_M_4uqcexBbEtrMxzNUCsUfg_BfS2s7F_rBO98BT4Pwuf80h0-unrPPGX1I5CtEZZE_F-ca8Ht3rSWb3c98B3-FqdSbnlTVXeZHwNoRpvmbr8qq8SzdQALHFy6b4s8hWp26llYmX1WDiDRkdyR4n25OewZP16nKVfjU-SK2pPyg3S8Cb6B3wplXm5zmXdgzh5OfS8AZ4M9i-tTqsrRuAN_8Cb85t6z5-_EFl0teir0QlE6rTokpZnpWsSMY6FyIv-_KYZTzL0izj7eaYblopS14Vx0okquaMC7ZhglU8Z8U6Z6JKc5FTVVYVHSvIGE1S6bXW52n2TpT3keoiE2WRaNmS9vdf0dUztGrj4CFjWvngH9OCCprq370yA8pvl_56o8LobBxGlOjoSI5MR6g8GhseaBKdrl9qosIY23VnJ-DNbHV7rU7O_kVdAN4scT3wZkn8XwAAAP__kGE69A">