diff options
author | dim <dim@FreeBSD.org> | 2015-12-30 11:49:41 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2015-12-30 11:49:41 +0000 |
commit | 3176e97f130184ece0e1a21352c8124cc83ff24a (patch) | |
tree | 0a5b74c0b9ca73aded34df95c91fcaf3815230d8 /test/CXX/basic/basic.start/basic.start.main/p3.cpp | |
parent | 1e9b8d38881c3213d1e67b0c47ab9b2c00721a5c (diff) | |
download | FreeBSD-src-3176e97f130184ece0e1a21352c8124cc83ff24a.zip FreeBSD-src-3176e97f130184ece0e1a21352c8124cc83ff24a.tar.gz |
Vendor import of clang trunk r256633:
https://llvm.org/svn/llvm-project/cfe/trunk@256633
Diffstat (limited to 'test/CXX/basic/basic.start/basic.start.main/p3.cpp')
-rw-r--r-- | test/CXX/basic/basic.start/basic.start.main/p3.cpp | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/test/CXX/basic/basic.start/basic.start.main/p3.cpp b/test/CXX/basic/basic.start/basic.start.main/p3.cpp new file mode 100644 index 0000000..f7085ca --- /dev/null +++ b/test/CXX/basic/basic.start/basic.start.main/p3.cpp @@ -0,0 +1,66 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST1 +// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST2 +// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST3 +// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST4 +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++14 -DTEST5 +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++14 -DTEST6 +// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST7 +// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST8 +// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST9 +// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST10 -ffreestanding + +#if TEST1 +int main; // expected-error{{main cannot be declared as global variable}} + +#elif TEST2 +// expected-no-diagnostics +int f () { + int main; + return main; +} + +#elif TEST3 +// expected-no-diagnostics +void x(int main) {}; +int y(int main); + +#elif TEST4 +// expected-no-diagnostics +class A { + static int main; +}; + +#elif TEST5 +// expected-no-diagnostics +template<class T> constexpr T main; + +#elif TEST6 +extern template<class T> constexpr T main; //expected-error{{expected unqualified-id}} + +#elif TEST7 +// expected-no-diagnostics +namespace foo { + int main; +} + +#elif TEST8 +void z(void) +{ + extern int main; // expected-error{{main cannot be declared as global variable}} +} + +#elif TEST9 +// expected-no-diagnostics +int q(void) +{ + static int main; + return main; +} + +#elif TEST10 +// expected-no-diagnostics +int main; + +#else +#error Unknown Test +#endif |