================
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic-errors %s
+
+namespace c {
+ extern "C" void main(); // expected-error {{invalid linkage specification
'extern "C"'}}
+}
+extern "C" {
+ int main(); // expected-error {{invalid linkage specification 'extern "C"'}}
+}
+extern "C" int main(); // expected-error {{invalid linkage specification
'extern "C"'}}
+extern "C" struct A { int main(); }; // ok
+
+namespace cpp {
+ extern "C++" int main(); // expected-error {{invalid linkage specification
'extern "C++"'}}
----------------
MitalAshok wrote:
This one is allowed, https://eel.is/c++draft/basic.start.main#3.4 only
disallows `extern "C"` `main`. If you are implementing that, could you add
tests for functions (`extern "C" { int main(); }`) and variables (`extern "C" {
void* main; }`) named `main`?
https://github.com/llvm/llvm-project/pull/101853
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits