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

    <tr>
        <th>Summary</th>
        <td>
            Alias template with unevaluated non-generic lambda with constexpr if statements complains about mismatched returns when used in a dependent context
        </td>
    </tr>

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

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

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

<pre>
    Maybe related to #58872 

https://godbolt.org/z/dGT5Y8s9v

```c++
template<bool B>
using choose = decltype([] {
  if constexpr (B) {
    return 0;
  } else {
    return 0u;
 }
}());

static_assert(__is_same(choose<true>, int));
static_assert(__is_same(choose<false>, unsigned));

template<bool B>
choose<B> dependent;
```

```
<source>:6:5: error: return type 'unsigned int' must match previous return type 'int' when lambda expression has unspecified explicit return type
    6 |     return 0u;
      | ^
<source>:2:28: note: while substituting into a lambda expression here
    2 | using choose = decltype([] {
      | ^
<source>:14:1: note: in instantiation of template type alias 'choose' requested here
   14 | choose<B> dependent;
      | ^
```

GCC and MSVC (after `__is_same`->`std::is_same_v`) are able to compile this.

It's fine when `B` isn't dependent. It's also fine if `choose<B>` is replaced with `decltype([]{ ... }())`.

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVUtv4zYQ_jX0ZRCDpp4-6ODHetFDTi0K9BRQ0thiS5EuZ-Rs-usLSnLspF5sN1Bkm_Pg9803HGoic3KIlci2Itsv9MCdD9WzYW031Pm_FrVv36pn_VYjBLSasQX2IFSSlWWhQMi9kJvp3TGfSSQboQ5CHU6-rb3lpQ8noQ7_CHVov_6W_VHS-nIfJHI5PY1Q2_iMq4z9OW4mkl3tvYWtSL5MloGMO0HTeU8IItlDi43ltzMKVU4kQBRzFgBzhMY7Yvx2DiBUuRVqfW8HCMhDcCBF8r4oij2gjekfOQ43T1HsZxLFPm6v1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