[all-commits] [llvm/llvm-project] 473769: [clang] [modules] Add err_main_in_named_module (#1...

Ashwin Banwari via All-commits all-commits at lists.llvm.org
Mon Jun 30 02:09:25 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 473769ec9b2f860813229eb449fb4298dfc7ff94
      https://github.com/llvm/llvm-project/commit/473769ec9b2f860813229eb449fb4298dfc7ff94
  Author: Ashwin Banwari <ashwinkbanwari at gmail.com>
  Date:   2025-06-30 (Mon, 30 Jun 2025)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/lib/Sema/SemaDecl.cpp
    M clang/test/SemaCXX/modules.cppm

  Log Message:
  -----------
  [clang] [modules] Add err_main_in_named_module (#146247)

Close https://github.com/llvm/llvm-project/issues/146229

As the issue said, main shouldn't be in any modules.

new diagnostic output:
```
/my/code/directory/main.cpp:3:1: warning: 'main' should not be attached to a named module; consider adding C++ language linkage [-Wmain]
    3 | int main() {
      | ^
      | extern "C++" 
1 warning generated.
```



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list