<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/55799>55799</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[C++20] Clang doesn't support constructing aggregate type with () syntax.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
danakj
</td>
</tr>
</table>
<pre>
This works in GCC and MSVC when compiling C++20:
```cpp
struct S {
int i;
};
S f() {
return S(2);
}
```
GCC: https://godbolt.org/z/Eh4vb55ro
MSVC: https://godbolt.org/z/hMhsMKPqb
Clang: https://godbolt.org/z/jjMTW65Yh
```
<source>:8:12: error: no matching conversion for functional-style cast from 'int' to 'S'
return S(2);
^~~
<source>:3:8: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const S' for 1st argument
struct S {
^
<source>:3:8: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'S' for 1st argument
struct S {
^
<source>:3:8: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided
1 error generated.
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzNVE1z2yAQ_TXoshOPhIwUH3RolKSHjmc64047PSIJSTgYFEB23V_fRXLqOJNJc8ihDCCWZZ_eWz4q0xyLb710cDD2wYHU8LksgesG1pvvJRx6oaE2u0EqqTsoCb3BSmOSfiLxLYmf-iyeaz0M84zzdqw9bIDkN_MMYJHagyTpaYbkt-fx1G-gJfSa0NVlmBV-tBo26KPovAC4_P9zMBSCNKH3fnCBL73H2pmmMsovjO3Q-o3trl_uK8asmaOC7PeE9everb98fazmsFJx3b0nbrtdf_uRsZ_9q_k7mWnpzGhrQdI7hLrGltAALqw1Ngy0gR33dR82pTZ6L6yTRkNrLLSjrj0aXF05f1QCau48tNbsgNAcdwB78CYYmND831mGcyHsjuRTfY1neuKK7LwI3xrPkWy4F4HjfCKQIOL7XoDcDUrW0qNvOD5fELYfEWAveaXESe2DNgd9IfU1QRNKUJBPqUjQ4LYbdwIXvXEsT8o-UNPO7MUHafoP1DSi5aPybwuy4nGUVjiI_7J0hJZQjR4SOHAHgzV72YhmppbMpxk6oYVFBs3ixV2ImiJtVumKR156JQrCbs7vD7uF6cpBY4TTmCIPbhwGY5-xDJeDd50VXRDoj4OAg_Q9nJ4Yd9Se_1pEo1XFi1uLq8Zqge8eGkrtnz5XqGAratyce-ncKFDfPWP5ahX1RdZUyTKjVXYtUpYlKV_xljHWsqQR2VLQSPFKKBdUEEq1OMAEgWPUEsmCxpTGLE2SfJklbMHrlrO8qlq-WrZ53pJlLHZcqkXgEZ6TyBYTpWrsHDqVdN6dndw52WkxJS3g89H3xhYN1_xhG01_LibmfwBku9EU">