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

    <tr>
        <th>Summary</th>
        <td>
            Error when explicitly specifying return type of generic lambda in constraint?
        </td>
    </tr>

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

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

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

<pre>
    https://godbolt.org/z/Yfsdrnn4E

```cpp
struct foo {
        foo(const foo&) = default;

        foo(auto) requires([]<int = 0> -> bool { return true; }()) {}
};

struct bar { foo x; };

int main() {}
```

```
<source>:4:21: error: substitution into constraint expression resulted in a non-constant expression
    4 | foo(auto) requires([]<int = 0> -> bool { return true; }()) {}
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<source>:1:8: note: while checking constraint satisfaction for template 'foo<foo>' required here
    1 | struct foo {
      |        ^~~
<source>:1:8: note: in instantiation of function template specialization 'foo::foo<foo>' requested here
<source>:7:8: note: while declaring the implicit copy constructor for 'bar'
    7 | struct bar { foo x; };
      |        ^
<source>:4:21: note: undefined function 'operator()<0>' cannot be used in a constant expression
    4 |         foo(auto) requires([]<int = 0> -> bool { return true; }()) {}
      |                            ^
<source>:4:21: note: declared here
<source>:4:21: error: substitution into constraint expression resulted in a non-constant expression
    4 |         foo(auto) requires([]<int = 0> -> bool { return true; }()) {}
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<source>:1:8: note: while checking constraint satisfaction for template 'foo<foo>' required here
    1 | struct foo {
      |        ^~~
<source>:1:8: note: while substituting deduced template arguments into function template 'foo' [with auto:1 = foo]
<source>:7:8: note: while declaring the implicit move constructor for 'bar'
    7 | struct bar { foo x; };
      | ^
<source>:4:21: note: undefined function 'operator()<0>' cannot be used in a constant expression
    4 |         foo(auto) requires([]<int = 0> -> bool { return true; }()) {}
      | ^
<source>:4:21: note: declared here
2 errors generated.
Compiler returned: 1
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzslt1yqzYQx59mfaNJBiQ7mAsu_PkOvRTSYtQjJKqP5CQXffaOBNTHqSdNZ9r05mgyECyx-9_frhZx79XFIDaw2cPmuOIx9NY1J_HW4rdVa-Vr04cwemA7oGeg54uVrdXh0boL0PMb0PMvnZfOmPUJiiMUu_n6VEx_YhynX3xwUQTSWUug2i9r685aoFthjc9zQJ-A1gTYkUjseNQB2P7G8PIKj8GmpQ5_i8qhB7qdYgB2UCZkEwWwE3lIl9ZanfwShyE6Q4KLCGxPoDqmF2mdvVb79Dz5qY7vPM8BtNxlQymQ74uJ25XJ_cCVmSzfml243IU1P7KDt9EJBHYCtlsD29ES2I6gc9alf3xsfVAhBmUNUSZYkgE6njzj99Gh92nKoY86oCTKEE6MNQ95Hb9ZNTklhJA1gepAvgQvySO5g83p98-Mu2wSlm0iYmzAdH_plUYiehTflLn8iMXzoHzHRWbWWUcCDqPmAQnQKsXMDvl6AlotUUvSo8Or4jIrvlfJ13jmkcP6nGaVcpizonhWZzvSRTMp_VOlH1EortXbtGYRvQO2u6cefbiR_05EdR-cRKG5S-RCj0QNo1ZCBSLs-DqzjCJYl_kBrVrugFZXAtWPfD7cKPd4_U31L0qjkdgpg_IKCWhlR3Q8WDeXGzsUMwzBjbGBtEiiX3bCJ3bBMr54N3wwPk9oyuJH6f_qnvI_0fzZWybN19yaC5Eoo0B51cjdJQ5ogp_S_tfWMwdBKwKb_YsKPckZZLsypyrNbY7_QpsZ7DP-V23mZ3_5hxjuNBE6dQtPLmgSDZSP08TBDqPS6GZBKJOB8u7hZiUbJmtW8xU2ZcWK7VNdM7rqm3XLyoKymvNNJbYt523bym25XWNHWdvhSjW0oOuyLJ6KTUnL8lGs2WZbU1ELiRVnFawLHLjSj1o_D-mAulLeR2zKclOW25XmLWqfD7qUGnwheRYoTede16SXHtp48bAutPLBX80EFTQ2pxQ7eenRpLTmitWv02e5e021vGTjdcT0Cc-QlCCaD63kqTCuHQPYeRWdfn-2VqGP7aOwA9Bz8j7fHkZnf0URgJ6zZg_0PAf13NA_AgAA__-y1oGy">