[clang] [clang] Add test for CWG2811 "Clarify "use" of main" (PR #96168)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 20 05:49:14 PDT 2024
================
@@ -964,7 +964,7 @@ def err_main_global_variable :
def warn_main_redefined : Warning<"variable named 'main' with external linkage "
"has undefined behavior">, InGroup<Main>;
def ext_main_used : Extension<
- "ISO C++ does not allow 'main' to be used by a program">, InGroup<Main>;
+ "expressions that refer to 'main' are an extension">, InGroup<Main>;
----------------
AaronBallman wrote:
```suggestion
"expressions that refer to 'main' are a Clang extension">, InGroup<Main>;
```
I think there's work to be done for full conformance here though. For example, this DR clarified that the following code is valid, but we still diagnose it as an extension:
```
int main() {}
decltype(main) maine;
```
https://godbolt.org/z/nn8rd483Y
https://github.com/llvm/llvm-project/pull/96168
More information about the cfe-commits
mailing list