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

    <tr>
        <th>Summary</th>
        <td>
            Entire lambda body is printed in a note
        </td>
    </tr>

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

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

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

<pre>
    Consider the following example (https://godbolt.org/z/P7dqa81bG):
```cpp
class S {
  class Incomplete;

  struct Inner {
    consteval void fn() {
      Incomplete i;
    }
  };

  static constexpr int r = [] {
    Inner{}.fn();
 return 0;
  }();

  class Incomplete {};
};
```
We issue the following diagnostics for it:
```
<source>:10:28: error: call to immediate function 'S::(anonymous class)::operator()' is not a constant expression
   10 | static constexpr int r = [] {
      | ^
<source>:11:13: note: undefined function 'fn' cannot be used in a constant expression
   11 |     Inner{}.fn();
      |             ^
<source>:10:28: note: in call to '[] {
    Inner{}.fn();
    return 0;
}.operator()()'
 10 |   static constexpr int r = [] {
      | ^~~~
   11 |     Inner{}.fn();
      |     ~~~~~~~~~~~~~
   12 | return 0;
      |     ~~~~~~~~~
   13 |   }();
      | ~~~
<source>:5:20: note: declared here
    5 |     consteval void fn() {
 |                    ^
<source>:10:24: error: constexpr variable 'r' must be initialized by a constant expression
   10 |   static constexpr int r = [] {
      |                        ^   ~~~~
   11 | Inner{}.fn();
      |     ~~~~~~~~~~~~~
   12 |     return 0;
      | ~~~~~~~~~
   13 |   }();
      |   ~~~
<source>:11:13: note: undefined function 'fn' cannot be used in a constant expression
   11 | Inner{}.fn();
      |             ^
<source>:10:28: note: in call to '[] {
    Inner{}.fn();
    return 0;
}.operator()()'
   10 |   static constexpr int r = [] {
      |                            ^~~~
   11 | Inner{}.fn();
      |     ~~~~~~~~~~~~~
   12 |     return 0;
      | ~~~~~~~~~
   13 |   }();
      |   ~~~
<source>:5:20: note: declared here
    5 |     consteval void fn() {
      |                    ^
2 errors generated.
```
It seems unfortunate that multi-line lambda body gets printed in the `in call to` note.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzUVs9zozYU_mvky5t4hAQGDhzYxO7k1pk99CzQw1ZHSK4kvJs95G_vCIhjU3fTbNudCeMxAj29H9_3STzhvdobxIpkn0j2sBJDOFhXbY1UWutVY-VTdW-NVxIdhANCZ7W2X5TZA34V_VEjEFYcQjh6wmvCdoTt9lY2Voe1dXvCdt8I2_2ayz9EkTS_EFZGM1qTDZ1-7fFIaN1q4T18BpJ_IrQGmJ4fTWtjiICEx_fjlA9uaAM8GoPubA_QWuMDnoSGk1USOkNYQVh5YQEX_kBNHuNbkj-Mo3i_DCOCame3X48OlAnggPAHmKC68DzmEh_zh_VL4Nm_wzA4A_QlXAxyMX-zWJhczRbnwQtihNa_ISjvB1wwIpXYG-uDaj101oEKC7DjmN97O7gWCd8SXieU8JoVhNeAzlkXB63QGoIF1fcolQgI3WDaoKwBwvLP0WekuhDGmqfeDn6qYOaW1_aITgTr5kJZDsqDsQHEBKcwASKk6L2yZsIwoUDy-3ehDuMKkm1vVJXEPx6LMTaqp4bBSOyUQXlVTGQrh1aYmF6DMHiUoMx3M03GuG_wfs7v8rqd6ysDL7kqc-aAsPw9cgNYKC7aLPmYWYn2M-zvk_sZ-Ofn5x_G5Pnymr2wcXa5ZW6umlfweWaxrV4XTaYLyLOIOL1EXGKrhUMJB3Q4O8jOUd84W5Y0v812er3fzqCfhFOiGc_U3EVl9oMfdamMCkpo9Q0lNE__YCP9CKN_c5FsOyN_Rfa_J_qvar3i7X1Ew22qf8JJ8PFPgf9DNXOlH1M1__EB8T2sJjWw6TTwsEcTaUK5Xny3HwN4xN7DYDrrwmDidzkcRIB-0EHdaWUQtOgbKSB2bbDH4OHolAmTkGOrQDb0VVVkQ8fy1itZcVnyUqywSnJe5AXPinR1qLqc5gwLpB1PGi6F3OCmLLIslaJL84avVMUoyyijWVKyDUvXTUM5o1mRbsoyE3lLUoq9UHqt9amPDeFq7FuqhGVlkq60aFD7sfdkzOCXqashjMVW1FVx0V0z7D1JqVY--Fc3QQWN1dYE5a7LVldFi7HC1eB0tehRVTgMzbq1PWG76HW-3R2d_R3bQNhuzMUTtpuTPVXszwAAAP__MVIdxw">