<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/100863>100863</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Clang] Member function definitions of local classes outside the class not rejected
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
MitalAshok
</td>
</tr>
</table>
<pre>
E.g. <https://godbolt.org/z/8qsqvWo1x>:
```c++
auto f() {
struct {
int g();
} x;
return x;
}
using x_t = decltype(f());
int x_t::g() {
return 1;
}
int main() {
return f().g();
}
```
is ill-formed because of [[class.mfct]p3](https://wg21.link/class.mfct#3):
> Member functions of a local class shall be defined inline in their class definition, if they are defined at all.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8U01vrDoM_TVmYxWBM3zMgkVbyq7rt6xCCJDXkEyT0Dd9v_4qlKpMde9FEUiOj4_PMebeq8lI2UDxAEWb8DXM1jXPKnB972f7mvR2-Gie0ilFYI9zCBcP7B6oA-omO_RWh9S6Caj7H6ir3_zb-z82vwJ7imlZC9nXu8w-jwB6iGeL8jVYHIFqoDNCtUcREX1wqwi3sfgoE3D6BAA73EHV4vUm4mRYnTkEoWqPHa1emQmvLwGBtThIocPHRQLVez9Hhsh6fQlRE7ufftfvzpb_iS1WWLgyf8HuvOlPed-Vvjy8KexRaX03WrfIAXsp-Ool2hG3kT4Izb1Pl1EEKNoLg6IFqm_n-N9EeaqVeQXqDunE2NbF7RjZEz7LpZcOx9WIoKzxkYyjtoJr3PDoZ6419hIHOSojB1RGKyNRGQyzVG5P225VrAH0iGqMlx_I3TeOB-Rap8nQsOHMzjyRTV4RZVVRVmUyN2M_ljTwvqgrkpIKMeRnKs55RWPOiooS1VBGp6yiKs8oz8uUF2diZSGoFqIsTzmcMrlwpVOt35f4KyfK-1U2eZbVJUs076X223oQCc3NBERxU1wTAXf9Onk4ZVr54L9LBBX0tlOPG6Jof3p2kL7ZdzBPerRr8GqQ0Y7dKWMDOvmvFEEOyep082MTVZjXPhV2AepiF_vn7uJsBAF1myoP1O3C3hv6FQAA___rhim_">