File: p3.cpp

package info (click to toggle)
llvm-toolchain-6.0 1%3A6.0.1-10
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 598,080 kB
  • sloc: cpp: 3,046,253; ansic: 595,057; asm: 271,965; python: 128,926; objc: 106,554; sh: 21,906; lisp: 10,191; pascal: 6,094; ml: 5,544; perl: 5,265; makefile: 2,227; cs: 2,027; xml: 686; php: 212; csh: 117
file content (66 lines) | stat: -rw-r--r-- 1,408 bytes parent folder | download | duplicates (29)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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