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

    <tr>
        <th>Summary</th>
        <td>
            if constexpr failing on ill-formed code inside untaken branch
        </td>
    </tr>

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

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

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

<pre>
    Hi folks, 

gcc compiles the following code, while clang doesn't (I tested with clang 11, 13, and 15). Is the compiler required to evaluate the untaken branch?
```
struct A {};

struct B {};

template <typename T> void D(void) {
  if constexpr (T::E) {
    A a;
    B b(a);
 }
}

struct C {
  static constexpr bool E = false;
};

int main() { D<C>(); }
``` 



</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsUttyozoQ_JrhZSouGJmLH3jwtU7e8wMCDaATITlIJJu_3xJmYye7Va6xLj3T3ail97q3zDXkB8hPiZzD4KZ61K-D1GaSozSDSxqnPuv_NHbOvHqgI0J6gnR_q33bYuvGqzbsMQwcUcZ9aNtj6xRH-MegDWNrpO1ROfYWqAwIVD1jYB9Y4YcOwwrIstiSiVilVZjlQLsNPt-Gr0wTTvw264kVBof8Ls0sAy-I2Qb5yhabSdp2AHFZxRbp-lu2PkxzG3CPUB6gPIE4PHpabw__vg08Xk2kA3EMn1e2cmR8AXHGd6cVnoCquADaLf1LD6LusHXWB_51naL3FxB7EPvzDxjiHuUXYdwfsAGqJNDufhxF3RR9LR6FHx8n-iCDbh_IG-cMnhHECTtpPN_t_WVV24Cj1BaoWnXiCcTxCOJ8OwJxeBDz5xt_C8itJqoWaid2MuE6K8piW-XbtEqGWrWZElWe5UXJnG3zdJvneZcVldyVZdVVia4pJZFSlmcVCaKNVGmZi6Jom5QUFRVsUx6lNhtj3seNm_pEez9zXaRllSZGNmz8EnCit5l90M4CUYz7VMeWp2buPWxTo33w9yFBB8P1t2frpDYx2M6iNuapc9PIaok5auu1-pm-ZJ5MPYRw9fGx6QJ06XUY5mbTuhHoErnWv6fr5P7nNgBdFvUe6LIY-B0AAP__2AYPnA">