[PATCH] D11658: [Sema] main can't be declared as global variable

Joerg Sonnenberger via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 10 11:32:57 PDT 2015


On Thu, Jul 30, 2015 at 07:01:22PM +0000, Davide Italiano wrote:
> Index: test/CXX/basic/basic.start/basic.start.main/p3.cpp
> ===================================================================
> --- test/CXX/basic/basic.start/basic.start.main/p3.cpp
> +++ test/CXX/basic/basic.start/basic.start.main/p3.cpp
> @@ -0,0 +1,8 @@
> +// RUN: %clang_cc1 -fsyntax-only -verify %s
> +
> +int main; // expected-error{{main can't be declared as global variable}}
> +
> +int f () {
> +  int main; // OK
> +  (void)main;
> +}

What about "static int main" in file scope?

Joerg


More information about the cfe-commits mailing list