<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/125677>125677</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] Clang accepts function attributes on lambdas in the wrong place
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang,
c++23
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
usx95
</td>
</tr>
</table>
<pre>
```cpp
void foo() {
auto x = [] [[noreturn]] (int msg) { throw; }; // accepted in wrong place.
auto y = [](int msg) [[noreturn]] { throw; }; // not accepted in the right place
auto z = [](int) [[clang::annotate_type("foo")]] {};
}
```
https://godbolt.org/z/sqnWo4v67
The attributes should be accepted after the parameters in the lambda declarator.
https://timsong-cpp.github.io/cppwp/n4868/expr.prim.lambda#nt:lambda-declarator
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx0k92OmzAQhZ9muLGCyPAXLrggG_EElXpZGWPAlbFde8hu9ukrIN2ku62ENLYln2_OGcNDUKORsob8DPkl4gtN1tdLeKvyqLP9rYYi2T_hHCTN1aqeDdYCngArBuUZkoYxxvhClr0xSC9s19rL2VgvafEG8st2iCdliM1hvF9nNHn7CumZQXnZCraALeNCSEeyZ8qwV2_NyJzmQsbPuNsT7pPwP9n_pxlLfxFpksyrcaKd-gx9_wJ9AIXmZoS0gbThxljiJH_QzcktLdxiQ8Dq0c_eBSTNukiaj7AhaSYiF1atrcPR9p3VFFs_ArbvgG34Zb7b7FqU672k-TZJxom86haSgYXJLrpnnXzY4gNJvzlz3PNZkvThj1fN567nrJdCc8_J-vhLB6TmYM14EM7Fo6Jp6WJlAVvh3KsDbE12Kk6ArXxzPnZezfEuCpgagrTZd4cHIurrtK_SikeyPpbpqSiPWZFHU93LQZZdkVVJnnZdlQnJ--FY5eUw8C5LRaRqTDBPMMmOeCyzPM5kXxai4DkOZcd5ClkiZ650rPV1XjOLVAiLrI-YF2UZad5JHbY3j7jPbJ3Ly7oDPAOeMV1P8kvk61Xi0C1jgCzRKlB4iJIivf06u0Z-YS_r4h55YMNiBClrngdjzT3sj-yfXne0eF1_GvwetbAzYLuS7-XgvP0pBQG2m7cA2N7tXWv8HQAA__-sRS0s">