<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/152018>152018</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang accepts invalid parenthesized constructor declarator
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
zygoloid
</td>
</tr>
</table>
<pre>
Per [[class.ctor.general]/1](https://eel.is/c++draft/class.ctor.general#1), a constructor declarator cannot be parenthesized:
```c++
struct A {
// OK, constructor
(A)(int);
// Error, not a constructor due to enclosing parens.
(A(float));
};
// OK, constructor
(A::A(int)) {}
// Error, not a constructor due to enclosing parens.
(A::A(float)) {}
```
But Clang accepts anyway, as do all other major compilers. We should reject under `-pedantic-errors`, but given the widespread support it probably makes sense to continue to accept this by default.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyck8GO4ygQhp8GX0qxMMSJc_Ah6Wwue9i9zbkMFZseAhbgtNJPP8JOdycz6stISIBw_f9XVS6M0fSOqGX1gdXHAqc0-NC-33pvvdFF5_Wt_Z8CzO8HZTHGUiUfyp4cBbSsPjJxquatGVIaI5N7Jk5MnIhsaSITJ8XEgYmDDnhO-fqniJAVEzsmXgBBeRdTmPI7aFIWA-ajQud8go5gxEAuDRTNO-nsxue14cu6uzG-X2RgD2ybrwALF_z3b3Z68Lk_NvsZojEu5YM8LMqfcf-E4EMOzSC_gU4EyQM5ZX00rl8gY_mg3Jytx1n4U3t7vB--55pjZV77LzKxm1PaHr9i_47tWf0B8EH_o65LMQ5TgheLrgdUisYUAd3tDW9z7yJoD2gt-DRQgAu-5sb5y2gshVjCD4I4-MlqCPRKKsHkdP63Nnw1kkaXjFpRTiRmP_EC3ZSgN1dykAaCN6MpjoFQQ5zG0YcEJsEYfIedvcEFf1KESC7O-SrvknFL7gsrpMFE6G6g6YyTTWWhW6l3cocFtdW2XktZryteDG3TVDVyrkitd1KKbd2o7oxCNlKvRSVVYVrBRc0bvq52Qkpeyo3aNDstzhXHShGxNacLGltae72UPvSFiXGitqoFr5rCYkc2fkxdaPNXq27qI1tza2KKX3HJJEvtc82Nu6I1-nkUvpmcYgq2fZ7M3qRh6krlL0ycstF9W43B574wcZpp8_Dega-t-BUAAP__eYdPqg">