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

    <tr>
        <th>Summary</th>
        <td>
            [Clang] Clang and GCC diverge on acceptance of function declaration inside constructor body
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

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

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

<pre>
    I'm seeking clarification on whether the following code is well-formed C++.
Repro: https://godbolt.org/z/jKsaj9a9E

GCC rejects it with:
```
<source>: In constructor 'S2::S2()':
<source>:7:5: error: return type specification for constructor invalid
    7 |     S2(S2());
      | ^~
<source>:7:12: error: 'S2' declared in a non-class scope
    7 | S2(S2());
      |            ^
Compiler returned: 1
```
However, Clang and MSVC both accept it.


## Program
```cpp
class S2 {
  int a;
public:
    S2(S2 &s2) : a(s2.a) {}

  S2() : a(0) {
    S2(S2());
 }
};

int main() {
    S2 s;
}
```

Is one compiler incorrect or not? Thank you for your time and insight!
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyEVE-P-jYQ_TTDZbTIjAmBQw6BXdpVVanqVlWvxh6I92fsyHZA20M_e-WE1cKqUlEk4mjmvec3f1RK9uSZG6i2UD3P1JC7EJu_vFVhdgjmo3kFqs-YmH9Yf0LtVLRHq1W2wWPweO04dxwxd4zH4Fy4jmHBMNqEV3bu6RjimQ3ugLZA2zmI9nfuYwDZYpdzn0C2QHug_SmYQ3B5HuIJaP830P79l6TeN2rzAqIF0f6022Hkd9Y5oc14tbkryaKFlbg9ogW5S2GImkG-FI5Xjzr4lOOgc4gIVL9RyZLtGwGtgTZA9Q3mMbV8rQoExxhieYmch-gxf_SMqWf9ZcUxxAca6y_KWQOiRUSsEepdecGR84t4A3J7i8ExBqqXf_5byYIepEz3oBoNl6KwQetRoQ_-STuVEiYden7g_z_uux9UxfJdOPfWcbzdm00hXnzz--dw5QtHoB3unPInVN7gr29_7vAQcodKa-4z2jyfalgekkASf4vhFNX5Hk73PYh20v9GCPUk0PqMalLbDwdn9VSuOz8RaJUIaINFogJaJ5qr8VxvoX6eiG_h92HiM-YB7rtFN4T6eTqDaIuks7L-E-4OAdMtakq6b03RviYMnlF_Omu9DjGyzhgi-pBB7vGPTvkf-BGGsas-whAx2zOPxlqf7KnLQIuZaaTZyI2acbOoq6VYrJdyNesauamMUSvJ4sjVweiaydRaUbXUsjJazWxDgiqxFgshScjVvJJyLeu6WlVLVR0Uw1LwWVk3d-5yLuM4sykN3CyqxUouZk4d2KVxZRDpUnMgKtsjNiXh6TCcEiyFsymnL4hssxv3zNglUD3ftUsZbGMvHE9clsrUM8prxnDE4-D1OGNTp0_zVnww_DByZV3Nhuiab1vF5m44zHU4A-2LmtvfUx9DWSVA-_F2CWh_u-CloX8DAAD__7r5e08">