1 #include "../ctu-hdr.h" 2 3 int callback_to_main(int x); f(int x)4int f(int x) { 5 return x - 1; 6 } 7 g(int x)8int g(int x) { 9 return callback_to_main(x) + 1; 10 } 11 12 int h_chain(int); 13 h(int x)14int h(int x) { 15 return 2 * h_chain(x); 16 } 17 18 namespace myns { fns(int x)19int fns(int x) { 20 return x + 7; 21 } 22 23 namespace embed_ns { fens(int x)24int fens(int x) { 25 return x - 3; 26 } 27 } // namespace embed_ns 28 29 class embed_cls { 30 public: 31 int fecl(int x); 32 }; fecl(int x)33int embed_cls::fecl(int x) { 34 return x - 7; 35 } 36 } // namespace myns 37 38 class mycls { 39 public: 40 int fcl(int x); 41 virtual int fvcl(int x); 42 static int fscl(int x); 43 44 class embed_cls2 { 45 public: 46 int fecl2(int x); 47 }; 48 }; 49 fcl(int x)50int mycls::fcl(int x) { 51 return x + 5; 52 } fvcl(int x)53int mycls::fvcl(int x) { 54 return x + 7; 55 } fscl(int x)56int mycls::fscl(int x) { 57 return x + 6; 58 } fecl2(int x)59int mycls::embed_cls2::fecl2(int x) { 60 return x - 11; 61 } 62 63 class derived : public mycls { 64 public: 65 virtual int fvcl(int x) override; 66 }; 67 fvcl(int x)68int derived::fvcl(int x) { 69 return x + 8; 70 } 71 72 namespace chns { 73 int chf2(int x); 74 75 class chcls { 76 public: 77 int chf4(int x); 78 }; 79 chf3(int x)80int chf3(int x) { 81 return chcls().chf4(x); 82 } 83 chf1(int x)84int chf1(int x) { 85 return chf2(x); 86 } 87 } 88 89 typedef struct { int n; } Anonymous; fun_using_anon_struct(int n)90int fun_using_anon_struct(int n) { Anonymous anon; anon.n = n; return anon.n; } 91 other_macro_diag(int x)92int other_macro_diag(int x) { 93 MACRODIAG(); 94 return x; 95 } 96 97 extern const int extInt = 2; 98 namespace intns { 99 extern const int extInt = 3; 100 } 101 struct S { 102 int a; 103 }; 104 extern const S extS = {.a = 4}; 105 struct A { 106 static const int a; 107 }; 108 const int A::a = 3; 109 struct SC { 110 const int a; 111 }; 112 SC extSC = {.a = 8}; 113 struct ST { 114 static struct SC sc; 115 }; 116 struct SC ST::sc = {.a = 2}; 117 struct SCNest { 118 struct SCN { 119 const int a; 120 } scn; 121 }; 122 SCNest extSCN = {.scn = {.a = 9}}; 123 SCNest::SCN extSubSCN = {.a = 1}; 124 struct SCC { SCCSCC125 SCC(int c) : a(c) {} 126 const int a; 127 }; 128 SCC extSCC{7}; 129 union U { 130 const int a; 131 const unsigned int b; 132 }; 133 U extU = {.a = 4}; 134 135 class TestAnonUnionUSR { 136 public: f(int value)137 inline float f(int value) { 138 union { 139 float f; 140 int i; 141 }; 142 i = value; 143 return f; 144 } 145 static const int Test; 146 }; 147 const int TestAnonUnionUSR::Test = 5; 148 149 struct DefaultParmContext { 150 static const int I; 151 int f(); 152 }; 153 fDefaultParm(int I=DefaultParmContext::I)154int fDefaultParm(int I = DefaultParmContext::I) { 155 return I; 156 } 157 testImportOfIncompleteDefaultParmDuringImport(int I)158int testImportOfIncompleteDefaultParmDuringImport(int I) { 159 return fDefaultParm(I); 160 } 161 162 const int DefaultParmContext::I = 0; 163 f()164int DefaultParmContext::f() { 165 return fDefaultParm(); 166 } 167 168 class TestDelegateConstructor { 169 public: TestDelegateConstructor()170 TestDelegateConstructor() : TestDelegateConstructor(2) {} TestDelegateConstructor(int)171 TestDelegateConstructor(int) {} 172 }; 173 testImportOfDelegateConstructor(int i)174int testImportOfDelegateConstructor(int i) { 175 TestDelegateConstructor TDC; 176 return i; 177 } 178