| 1 |
#include "../ctu-hdr.h" |
| 2 |
|
| 3 |
int callback_to_main(int x); |
| 4 |
int f(int x) { |
| 5 |
return x - 1; |
| 6 |
} |
| 7 |
|
| 8 |
int g(int x) { |
| 9 |
return callback_to_main(x) + 1; |
| 10 |
} |
| 11 |
|
| 12 |
int h_chain(int); |
| 13 |
|
| 14 |
int h(int x) { |
| 15 |
return 2 * h_chain(x); |
| 16 |
} |
| 17 |
|
| 18 |
namespace myns { |
| 19 |
int fns(int x) { |
| 20 |
return x + 7; |
| 21 |
} |
| 22 |
|
| 23 |
namespace embed_ns { |
| 24 |
int 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 |
}; |
| 33 |
int 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 |
|
| 50 |
int mycls::fcl(int x) { |
| 51 |
return x + 5; |
| 52 |
} |
| 53 |
int mycls::fvcl(int x) { |
| 54 |
return x + 7; |
| 55 |
} |
| 56 |
int mycls::fscl(int x) { |
| 57 |
return x + 6; |
| 58 |
} |
| 59 |
int 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 |
|
| 68 |
int 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 |
|
| 80 |
int chf3(int x) { |
| 81 |
return chcls().chf4(x); |
| 82 |
} |
| 83 |
|
| 84 |
int chf1(int x) { |
| 85 |
return chf2(x); |
| 86 |
} |
| 87 |
} |
| 88 |
|
| 89 |
typedef struct { int n; } Anonymous; |
| 90 |
int fun_using_anon_struct(int n) { Anonymous anon; anon.n = n; return anon.n; } |
| 91 |
|
| 92 |
int 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 |
extern S extNonConstS = {.a = 4}; |
| 106 |
struct NonTrivialS { |
| 107 |
int a; |
| 108 |
~NonTrivialS(); |
| 109 |
}; |
| 110 |
extern const NonTrivialS extNTS = {.a = 4}; |
| 111 |
struct A { |
| 112 |
static const int a; |
| 113 |
}; |
| 114 |
const int A::a = 3; |
| 115 |
struct SC { |
| 116 |
const int a; |
| 117 |
}; |
| 118 |
extern const SC extSC = {.a = 8}; |
| 119 |
struct ST { |
| 120 |
static const struct SC sc; |
| 121 |
}; |
| 122 |
const struct SC ST::sc = {.a = 2}; |
| 123 |
struct SCNest { |
| 124 |
struct SCN { |
| 125 |
const int a; |
| 126 |
} scn; |
| 127 |
}; |
| 128 |
SCNest extSCN = {.scn = {.a = 9}}; |
| 129 |
extern SCNest::SCN const extSubSCN = {.a = 1}; |
| 130 |
struct SCC { |
| 131 |
SCC(int c) : a(c) {} |
| 132 |
const int a; |
| 133 |
}; |
| 134 |
SCC extSCC{7}; |
| 135 |
union U { |
| 136 |
const int a; |
| 137 |
const unsigned int b; |
| 138 |
}; |
| 139 |
extern const U extU = {.a = 4}; |
| 140 |
|
| 141 |
class TestAnonUnionUSR { |
| 142 |
public: |
| 143 |
inline float f(int value) { |
| 144 |
union { |
| 145 |
float f; |
| 146 |
int i; |
| 147 |
}; |
| 148 |
i = value; |
| 149 |
return f; |
| 150 |
} |
| 151 |
static const int Test; |
| 152 |
}; |
| 153 |
const int TestAnonUnionUSR::Test = 5; |
| 154 |
|
| 155 |
struct DefaultParmContext { |
| 156 |
static const int I; |
| 157 |
int f(); |
| 158 |
}; |
| 159 |
|
| 160 |
int fDefaultParm(int I = DefaultParmContext::I) { |
| 161 |
return I; |
| 162 |
} |
| 163 |
|
| 164 |
int testImportOfIncompleteDefaultParmDuringImport(int I) { |
| 165 |
return fDefaultParm(I); |
| 166 |
} |
| 167 |
|
| 168 |
const int DefaultParmContext::I = 0; |
| 169 |
|
| 170 |
int DefaultParmContext::f() { |
| 171 |
return fDefaultParm(); |
| 172 |
} |
| 173 |
|
| 174 |
class TestDelegateConstructor { |
| 175 |
public: |
| 176 |
TestDelegateConstructor() : TestDelegateConstructor(2) {} |
| 177 |
TestDelegateConstructor(int) {} |
| 178 |
}; |
| 179 |
|
| 180 |
int testImportOfDelegateConstructor(int i) { |
| 181 |
TestDelegateConstructor TDC; |
| 182 |
return i; |
| 183 |
} |