[clang] [clang] [modules] Add err_main_in_named_module (PR #146635)

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 2 00:13:24 PDT 2025


================
@@ -12486,6 +12486,14 @@ void Sema::CheckMain(FunctionDecl *FD, const DeclSpec &DS) {
                                 : FixItHint());
       FD->setInvalidDecl(true);
     }
+
+    // In C++ [basic.start.main]p3, it is said a program attaching main to a
+    // named module is ill-formed.
----------------
ChuanqiXu9 wrote:

nit: generally we we'll cite it directly:

```suggestion
    // [basic.start.main]p3:
    //
    //       ....
```

https://github.com/llvm/llvm-project/pull/146635


More information about the cfe-commits mailing list