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

    <tr>
        <th>Summary</th>
        <td>
            Reference argument specified as template can't be used in constexpr if
        </td>
    </tr>

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

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

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

<pre>
    Perhaps a duplicate of #63139

The following fails to compile with 19.1.0 and current trunk. It works if the argument is a value type instead of reference. Works with GCC.

```
class Foo
{
public:
    constexpr static bool foo = true;
};

template <typename T>
int func(T& t)
{
    if constexpr (t.foo)
    {
 return 1;
    }
    else
    {
        return 0;
    }
}

int main()
{
    Foo f;

    int i = func(f);
    return i;
}
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxcU0-Pmz4Q_TTmMlpk7CTEBw7ZzY-fequqlXo2ZhzcNTbyn03321cmNJsuQmAx8-a9mXnIGM3FIXZk_0z250rmNPnQyQGtvZg05aEa_PjRfccwySWChDEv1iiZELwGwviBN1wQeiL09DohaG-tvxp3AS2NjZA8KD8vxiJcTZqgEXVTU5BuBJVDQJcghezeaviW4OrDWwSjIU0IMlzyXOKm0L5LmxHSx4JgXEwox8IfUGNAp7CGnyt25fj_5aW-KSIHut30pKyMEXrvy_f2mdDTkgdrFOElEwBA-VL59xIgJpmMgsF7C9p7IPxcZCLhzyv6vB3oKeG82DINwl-KOidnhFfC_yP0ZFwCnZ0i7PhK2AESYeJOXgiNfuAk7Jhq7f0tqYS3xIApBwfNjfMWOG8ntBH_zd6uDUS_grbnTdwsjSPs-FVW7z3oe4er0LKGdQpbP7pg7qU3MvM5nofRV2PHR8GFrLBr2l1DWXukopq6oRWKa84la5QQfDeoRu7EIAaOiqI-VKZjlO0pp7w57ikV9aB2ohFMSEpbVK0gO4qzNLa29n2ufbhUJsaMXcPEvuWVLTaOq7UZc3iFNUoYK04PXQE9DfkSyY5aE1P8LJNMstj9-OuuTy_GBZXRBkeQEe67V9IR1iYYEHLEEYx72KvRVQ62m1JaYvEa6wnrb_9WrfxMWF9ot9fTEvwvVImwfhUbCeu3bt479icAAP__T8sb2A">