Skip to content

#101853 breaks extern "C" int main... even when -Wmain is disabled #104570

Closed
@alexfh

Description

@alexfh

#101853 introduces a couple of problems. I guess, this boils down to marking the declaration of main() invalid in case it's declared with extern "C", but I may be wrong here.

The first problem is a clang crash: https://gcc.godbolt.org/z/dWETErhzM

The second one is a change of behavior of code that declares main() extern "C" (see my comment 37ec6e5#r145380228). This one still needs some work to create a standalone repro for, but I suspect that both issues are related to marking the declaration invalid.

The problem with both cases is that in some codebases the non-trivial amount of cleanup is necessary for this, but Clang doesn't allow to postpone the cleanup and retain the old behavior by just ignoring the diagnostic (-Wno-main). Even if the diagnostic is not issued, the issues above still manifest.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions