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

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 30 00:37:36 PDT 2025


================
@@ -1062,6 +1062,8 @@ def err_constexpr_main : Error<
   "'main' is not allowed to be declared %select{constexpr|consteval}0">;
 def err_deleted_main : Error<"'main' is not allowed to be deleted">;
 def err_mainlike_template_decl : Error<"%0 cannot be a template">;
+def warn_main_in_named_module
+    : Warning<"'main' should not be attached to a named module">;
----------------
ChuanqiXu9 wrote:

And suggest them to wrap it into language linkage.

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


More information about the cfe-commits mailing list