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

    <tr>
        <th>Summary</th>
        <td>
            [Clang] Uses of global `main` should also forbidden in freestanding modes
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          frederick-vs-ja
      </td>
    </tr>
</table>

<pre>
    According to https://github.com/cplusplus/CWG/issues/483#issuecomment-1863413706, it is intended that every restriction on the global `main` function is also enforced in freestanding modes.
So the following program should also be rejected in freestanding modes, but Clang (and GCC) currently doesn't ([Godbolt link](https://godbolt.org/z/dszsT5e5W)).
```C++
int main()
{
    return main();
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8U9FuozoQ_ZrhZZQIxkDMAw9NovQD7l312eAB3Bo7sk1W7devIFltVXVXGoTGc3zsM3OsYjSjY26hOkJ1ztSSJh_aIbDmYPq33S3uXlXWef3ePvW9D9q4EZPHKaVrBPEEdAG6jCZNS7fv_Qx06a92iesHdDm9PANdTIwLr2kpBZDY0t7PM7u0K2QtykIc8hrohCahiWhcYqdZY5pUQr5xeMfAMQXTJ-MdeodpYhyt75RFqPNZGQd1jsPi7ggTUdnokd3gQ88ajcMhMMek3CZh9prjHvIz5E__-Y1u8Nb6n2vxGvwY1Ixx8ovVd6aOMfAr9-lvZOv1uyXhySo3IpBUTuPz6QTUYL-EwC7Zd9SeowM6pBUB1fHZ687bhNa4N6jOQPJLZ-_1vQ8j0OUD6KLjR_y_4uoFqAFqHhqgzu9xAjqusa0al3DrDckVfUceHkVExMBpCe4zRhx_w85fmDPdCt2IRmXcFgeiqiBRiGxqpZZ9NwxS1dw3zYFKlqJueKi7qiF5kJlpKacyl3lRFEIKsddDV8m8ymsp61LoCsqcZ2Xs3trbvGrNNo-0RV6UhzKzqmMbN48S9Wt_gWi1a2jXDbtuGSOUuTUxxT8UySS7GXubCFRn_BE5oh--Mc7nSQ8-dEZrdt_POVuCbf9h__X8x293DX61zOcn8JB0a-lXAAAA___lDhli">