https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116172

            Bug ID: 116172
           Summary: Uses of global main should also forbidden in
                    freestanding modes
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: de34 at live dot cn
  Target Milestone: ---

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 GCC
(and Clang) currently doesn't (https://godbolt.org/z/dszsT5e5W).

```
int main()
{
    return main();
}
```

Reply via email to