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

    <tr>
        <th>Summary</th>
        <td>
            [clang] Regression in lambda return type inference
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            c++,
            clang:frontend,
            rejects-valid,
            lambda,
            regression:21
      </td>
    </tr>

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

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

<pre>
    I've found a regression in the return type inference in lambda expressions that seems fairly severe

```cpp
int v;
bool foo() {
  auto init = [](auto) { return true; };
  if constexpr (0)
    return init(v);
  return false;
}
```

This compiles in clang20 and gcc, but not in main.

I believe it to be broken in clang21 as well, but I'm not sure if I was building the correct branch so will need to re-test.

Pre-emptively tagging as a 21 regression as I am reasonably certain that it does repro and want people to see this in case they have any immediate ideas of what might be the cause before I start looking at this myself.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxsU9GuozgPfppwY7WiAab0goueqSr17tevfQETDGQmJCg2dPv2q0DPnLPSSpYgdvz5--wYme3giRpVfajqluEiY4hN-DUuXrI2dK_mofR5JejD4jtAiDREYrbBg_UgI0EkWaIHec0E1vcUyZv0Bw6ntkOgv-d3BoOMKMBEE0OPNroXMK0USeXXZD_y3cw8q_xqvcCqig-VX9sQHPQhKF0rfQF1Tk4AXCSA9VZAFTfYNShdJ_f72h92cSFVfIA633ZEANuDCZ4l8QOl61zpyxaAz6SErHS9psA76R3p0THtvoT4jfqu5K_RMpgwzdYRp14Yh37QOaDvYDBG6Z_QLgI-SIpOaP1xz3xAS87SSmAFJEBL0Mbwm_wXygmQ4UnOfaKkEU0bFi-RkrAHPJGhXazrrB-2MZkQIxmBNqI3I3CAp3UOPFGX6kQ6CLG8Wfwv0oGmWexK7gWCw5BgkAFBn76_AWR4AE4QCTl4bN0LDEXB7W2gJBFdIIZIcwyb-id6gZnC7CjVZSKQ1K0kDzkd6AUjrgToX2CniTqLQmA7QobQwzPhTnYYJTVnk4YLE7TUh0jwABaMAi6E3xtp2fGnF5Prj1nXFN2luGBGzelcVfpS6kudjc3ZXExxpratdPGja0-9Nn2fl9256-pTX58z2-hcV3l9qvSpLKv62Oe6Kw0WRaFNUZW9KnOa0Lqjc-t0DHHILPNCzakq6rrMHLbkeNs0rY3SH5tppX-mc5qsKq59DF7Id38CkX6RET6s6OyXd1-tb5c-B6KKqz4lf3XLYpOIHNplYFXmzrLwFzWx4ra13ytXN_j_vzb7vbz_udzZEl0zisysiqvSd6Xvg5VxaY8mTErfU5H35zDHkAQofd-awUrf3_1YG_1PAAAA___ypnUv">