Richard Smith | 59efe26 | 2011-11-11 04:05:33 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple i686-linux -fsyntax-only -verify -std=c++11 %s |
| 2 | |
Richard Smith | f48fdb0 | 2011-12-09 22:58:01 +0000 | [diff] [blame^] | 3 | #define static_assert_fold static_assert |
Richard Smith | 59efe26 | 2011-11-11 04:05:33 +0000 | [diff] [blame] | 4 | |
| 5 | namespace StaticAssertFoldTest { |
| 6 | |
| 7 | int x; |
| 8 | static_assert_fold(++x, "test"); // expected-error {{not an integral constant expression}} |
| 9 | static_assert_fold(false, "test"); // expected-error {{test}} |
| 10 | |
| 11 | } |
| 12 | |
| 13 | // FIXME: support const T& parameters here. |
| 14 | //template<typename T> constexpr T id(const T &t) { return t; } |
| 15 | template<typename T> constexpr T id(T t) { return t; } |
| 16 | // FIXME: support templates here. |
| 17 | //template<typename T> constexpr T min(const T &a, const T &b) { |
| 18 | // return a < b ? a : b; |
| 19 | //} |
| 20 | //template<typename T> constexpr T max(const T &a, const T &b) { |
| 21 | // return a < b ? b : a; |
| 22 | //} |
| 23 | constexpr int min(const int &a, const int &b) { return a < b ? a : b; } |
| 24 | constexpr int max(const int &a, const int &b) { return a < b ? b : a; } |
| 25 | |
| 26 | struct MemberZero { |
| 27 | constexpr int zero() { return 0; } |
| 28 | }; |
| 29 | |
| 30 | namespace DerivedToVBaseCast { |
| 31 | |
| 32 | struct U { int n; }; |
| 33 | struct V : U { int n; }; |
| 34 | struct A : virtual V { int n; }; |
| 35 | struct Aa { int n; }; |
| 36 | struct B : virtual A, Aa {}; |
| 37 | struct C : virtual A, Aa {}; |
| 38 | struct D : B, C {}; |
| 39 | |
| 40 | D d; |
| 41 | constexpr B *p = &d; |
| 42 | constexpr C *q = &d; |
| 43 | static_assert_fold((void*)p != (void*)q, ""); |
| 44 | static_assert_fold((A*)p == (A*)q, ""); |
| 45 | static_assert_fold((Aa*)p != (Aa*)q, ""); |
| 46 | |
| 47 | constexpr B &pp = d; |
| 48 | constexpr C &qq = d; |
| 49 | static_assert_fold((void*)&pp != (void*)&qq, ""); |
| 50 | static_assert_fold(&(A&)pp == &(A&)qq, ""); |
| 51 | static_assert_fold(&(Aa&)pp != &(Aa&)qq, ""); |
| 52 | |
| 53 | constexpr V *v = p; |
| 54 | constexpr V *w = q; |
| 55 | constexpr V *x = (A*)p; |
| 56 | static_assert_fold(v == w, ""); |
| 57 | static_assert_fold(v == x, ""); |
| 58 | |
| 59 | static_assert_fold((U*)&d == p, ""); |
| 60 | static_assert_fold((U*)&d == q, ""); |
| 61 | static_assert_fold((U*)&d == v, ""); |
| 62 | static_assert_fold((U*)&d == w, ""); |
| 63 | static_assert_fold((U*)&d == x, ""); |
| 64 | |
| 65 | struct X {}; |
| 66 | struct Y1 : virtual X {}; |
| 67 | struct Y2 : X {}; |
| 68 | struct Z : Y1, Y2 {}; |
| 69 | Z z; |
| 70 | static_assert_fold((X*)(Y1*)&z != (X*)(Y2*)&z, ""); |
| 71 | |
| 72 | } |
| 73 | |
Richard Smith | f64699e | 2011-11-11 08:28:03 +0000 | [diff] [blame] | 74 | namespace ConstCast { |
| 75 | |
| 76 | constexpr int n1 = 0; |
| 77 | constexpr int n2 = const_cast<int&>(n1); |
| 78 | constexpr int *n3 = const_cast<int*>(&n1); |
| 79 | constexpr int n4 = *const_cast<int*>(&n1); |
| 80 | constexpr const int * const *n5 = const_cast<const int* const*>(&n3); |
| 81 | constexpr int **n6 = const_cast<int**>(&n3); |
| 82 | constexpr int n7 = **n5; |
| 83 | constexpr int n8 = **n6; |
| 84 | |
| 85 | } |
| 86 | |
Richard Smith | 59efe26 | 2011-11-11 04:05:33 +0000 | [diff] [blame] | 87 | namespace TemplateArgumentConversion { |
| 88 | template<int n> struct IntParam {}; |
| 89 | |
| 90 | using IntParam0 = IntParam<0>; |
Richard Smith | e24f5fc | 2011-11-17 22:56:20 +0000 | [diff] [blame] | 91 | // FIXME: This should be accepted once we implement the new ICE rules. |
Richard Smith | 59efe26 | 2011-11-11 04:05:33 +0000 | [diff] [blame] | 92 | using IntParam0 = IntParam<id(0)>; // expected-error {{not an integral constant expression}} |
| 93 | using IntParam0 = IntParam<MemberZero().zero>; // expected-error {{did you mean to call it with no arguments?}} expected-error {{not an integral constant expression}} |
| 94 | } |
| 95 | |
| 96 | namespace CaseStatements { |
| 97 | void f(int n) { |
| 98 | switch (n) { |
| 99 | // FIXME: Produce the 'add ()' fixit for this. |
| 100 | case MemberZero().zero: // desired-error {{did you mean to call it with no arguments?}} expected-error {{not an integer constant expression}} |
Richard Smith | e24f5fc | 2011-11-17 22:56:20 +0000 | [diff] [blame] | 101 | // FIXME: This should be accepted once we implement the new ICE rules. |
Richard Smith | 59efe26 | 2011-11-11 04:05:33 +0000 | [diff] [blame] | 102 | case id(1): // expected-error {{not an integer constant expression}} |
| 103 | return; |
| 104 | } |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | extern int &Recurse1; |
| 109 | int &Recurse2 = Recurse1, &Recurse1 = Recurse2; |
| 110 | constexpr int &Recurse3 = Recurse2; // expected-error {{must be initialized by a constant expression}} |
| 111 | |
| 112 | namespace MemberEnum { |
| 113 | struct WithMemberEnum { |
| 114 | enum E { A = 42 }; |
| 115 | } wme; |
| 116 | |
| 117 | static_assert_fold(wme.A == 42, ""); |
| 118 | } |
| 119 | |
| 120 | namespace DefaultArguments { |
| 121 | |
| 122 | const int z = int(); |
| 123 | constexpr int Sum(int a = 0, const int &b = 0, const int *c = &z, char d = 0) { |
| 124 | return a + b + *c + d; |
| 125 | } |
| 126 | const int four = 4; |
| 127 | constexpr int eight = 8; |
| 128 | constexpr const int twentyseven = 27; |
| 129 | static_assert_fold(Sum() == 0, ""); |
| 130 | static_assert_fold(Sum(1) == 1, ""); |
| 131 | static_assert_fold(Sum(1, four) == 5, ""); |
| 132 | static_assert_fold(Sum(1, eight, &twentyseven) == 36, ""); |
| 133 | static_assert_fold(Sum(1, 2, &four, eight) == 15, ""); |
| 134 | |
| 135 | } |
| 136 | |
| 137 | namespace Ellipsis { |
| 138 | |
| 139 | // Note, values passed through an ellipsis can't actually be used. |
| 140 | constexpr int F(int a, ...) { return a; } |
| 141 | static_assert_fold(F(0) == 0, ""); |
| 142 | static_assert_fold(F(1, 0) == 1, ""); |
| 143 | static_assert_fold(F(2, "test") == 2, ""); |
| 144 | static_assert_fold(F(3, &F) == 3, ""); |
| 145 | int k = 0; |
| 146 | static_assert_fold(F(4, k) == 3, ""); // expected-error {{constant expression}} |
| 147 | |
| 148 | } |
| 149 | |
| 150 | namespace Recursion { |
| 151 | constexpr int fib(int n) { return n > 1 ? fib(n-1) + fib(n-2) : n; } |
| 152 | static_assert_fold(fib(11) == 89, ""); |
| 153 | |
| 154 | constexpr int gcd_inner(int a, int b) { |
| 155 | return b == 0 ? a : gcd_inner(b, a % b); |
| 156 | } |
| 157 | constexpr int gcd(int a, int b) { |
| 158 | return gcd_inner(max(a, b), min(a, b)); |
| 159 | } |
| 160 | |
| 161 | static_assert_fold(gcd(1749237, 5628959) == 7, ""); |
| 162 | } |
| 163 | |
| 164 | namespace FunctionCast { |
| 165 | // When folding, we allow functions to be cast to different types. Such |
| 166 | // cast functions cannot be called, even if they're constexpr. |
| 167 | constexpr int f() { return 1; } |
| 168 | typedef double (*DoubleFn)(); |
| 169 | typedef int (*IntFn)(); |
| 170 | int a[(int)DoubleFn(f)()]; // expected-error {{variable length array}} |
| 171 | int b[(int)IntFn(f)()]; // ok |
| 172 | } |
| 173 | |
| 174 | namespace StaticMemberFunction { |
| 175 | struct S { |
| 176 | static constexpr int k = 42; |
| 177 | static constexpr int f(int n) { return n * k + 2; } |
| 178 | } s; |
| 179 | |
| 180 | constexpr int n = s.f(19); |
| 181 | static_assert_fold(S::f(19) == 800, ""); |
| 182 | static_assert_fold(s.f(19) == 800, ""); |
| 183 | static_assert_fold(n == 800, ""); |
Richard Smith | 1bf9a9e | 2011-11-12 22:28:03 +0000 | [diff] [blame] | 184 | |
| 185 | constexpr int (*sf1)(int) = &S::f; |
| 186 | constexpr int (*sf2)(int) = &s.f; |
| 187 | constexpr const int *sk = &s.k; |
Richard Smith | 59efe26 | 2011-11-11 04:05:33 +0000 | [diff] [blame] | 188 | } |
| 189 | |
| 190 | namespace ParameterScopes { |
| 191 | |
| 192 | const int k = 42; |
| 193 | constexpr const int &ObscureTheTruth(const int &a) { return a; } |
| 194 | constexpr const int &MaybeReturnJunk(bool b, const int a) { |
| 195 | return ObscureTheTruth(b ? a : k); |
| 196 | } |
| 197 | static_assert_fold(MaybeReturnJunk(false, 0) == 42, ""); // ok |
| 198 | constexpr int a = MaybeReturnJunk(true, 0); // expected-error {{constant expression}} |
| 199 | |
| 200 | constexpr const int MaybeReturnNonstaticRef(bool b, const int a) { |
| 201 | // If ObscureTheTruth returns a reference to 'a', the result is not a |
| 202 | // constant expression even though 'a' is still in scope. |
| 203 | return ObscureTheTruth(b ? a : k); |
| 204 | } |
| 205 | static_assert_fold(MaybeReturnNonstaticRef(false, 0) == 42, ""); // ok |
| 206 | constexpr int b = MaybeReturnNonstaticRef(true, 0); // expected-error {{constant expression}} |
| 207 | |
| 208 | constexpr int InternalReturnJunk(int n) { |
| 209 | // FIXME: We should reject this: it never produces a constant expression. |
| 210 | return MaybeReturnJunk(true, n); |
| 211 | } |
| 212 | constexpr int n3 = InternalReturnJunk(0); // expected-error {{must be initialized by a constant expression}} |
| 213 | |
| 214 | constexpr int LToR(int &n) { return n; } |
| 215 | constexpr int GrabCallersArgument(bool which, int a, int b) { |
| 216 | return LToR(which ? b : a); |
| 217 | } |
| 218 | static_assert_fold(GrabCallersArgument(false, 1, 2) == 1, ""); |
| 219 | static_assert_fold(GrabCallersArgument(true, 4, 8) == 8, ""); |
| 220 | |
| 221 | } |
| 222 | |
| 223 | namespace Pointers { |
| 224 | |
| 225 | constexpr int f(int n, const int *a, const int *b, const int *c) { |
| 226 | return n == 0 ? 0 : *a + f(n-1, b, c, a); |
| 227 | } |
| 228 | |
| 229 | const int x = 1, y = 10, z = 100; |
| 230 | static_assert_fold(f(23, &x, &y, &z) == 788, ""); |
| 231 | |
| 232 | constexpr int g(int n, int a, int b, int c) { |
| 233 | return f(n, &a, &b, &c); |
| 234 | } |
| 235 | static_assert_fold(g(23, x, y, z) == 788, ""); |
| 236 | |
| 237 | } |
| 238 | |
| 239 | namespace FunctionPointers { |
| 240 | |
| 241 | constexpr int Double(int n) { return 2 * n; } |
| 242 | constexpr int Triple(int n) { return 3 * n; } |
| 243 | constexpr int Twice(int (*F)(int), int n) { return F(F(n)); } |
| 244 | constexpr int Quadruple(int n) { return Twice(Double, n); } |
| 245 | constexpr auto Select(int n) -> int (*)(int) { |
| 246 | return n == 2 ? &Double : n == 3 ? &Triple : n == 4 ? &Quadruple : 0; |
| 247 | } |
| 248 | constexpr int Apply(int (*F)(int), int n) { return F(n); } |
| 249 | |
| 250 | static_assert_fold(1 + Apply(Select(4), 5) + Apply(Select(3), 7) == 42, ""); |
| 251 | |
| 252 | constexpr int Invalid = Apply(Select(0), 0); // expected-error {{must be initialized by a constant expression}} |
| 253 | |
| 254 | } |
| 255 | |
| 256 | namespace PointerComparison { |
| 257 | |
| 258 | int x, y; |
| 259 | static_assert_fold(&x == &y, "false"); // expected-error {{false}} |
| 260 | static_assert_fold(&x != &y, ""); |
| 261 | constexpr bool g1 = &x == &y; |
| 262 | constexpr bool g2 = &x != &y; |
| 263 | constexpr bool g3 = &x <= &y; // expected-error {{must be initialized by a constant expression}} |
| 264 | constexpr bool g4 = &x >= &y; // expected-error {{must be initialized by a constant expression}} |
| 265 | constexpr bool g5 = &x < &y; // expected-error {{must be initialized by a constant expression}} |
| 266 | constexpr bool g6 = &x > &y; // expected-error {{must be initialized by a constant expression}} |
| 267 | |
| 268 | struct S { int x, y; } s; |
| 269 | static_assert_fold(&s.x == &s.y, "false"); // expected-error {{false}} |
| 270 | static_assert_fold(&s.x != &s.y, ""); |
| 271 | static_assert_fold(&s.x <= &s.y, ""); |
| 272 | static_assert_fold(&s.x >= &s.y, "false"); // expected-error {{false}} |
| 273 | static_assert_fold(&s.x < &s.y, ""); |
| 274 | static_assert_fold(&s.x > &s.y, "false"); // expected-error {{false}} |
| 275 | |
| 276 | static_assert_fold(0 == &y, "false"); // expected-error {{false}} |
| 277 | static_assert_fold(0 != &y, ""); |
| 278 | constexpr bool n3 = 0 <= &y; // expected-error {{must be initialized by a constant expression}} |
| 279 | constexpr bool n4 = 0 >= &y; // expected-error {{must be initialized by a constant expression}} |
| 280 | constexpr bool n5 = 0 < &y; // expected-error {{must be initialized by a constant expression}} |
| 281 | constexpr bool n6 = 0 > &y; // expected-error {{must be initialized by a constant expression}} |
| 282 | |
| 283 | static_assert_fold(&x == 0, "false"); // expected-error {{false}} |
| 284 | static_assert_fold(&x != 0, ""); |
| 285 | constexpr bool n9 = &x <= 0; // expected-error {{must be initialized by a constant expression}} |
| 286 | constexpr bool n10 = &x >= 0; // expected-error {{must be initialized by a constant expression}} |
| 287 | constexpr bool n11 = &x < 0; // expected-error {{must be initialized by a constant expression}} |
| 288 | constexpr bool n12 = &x > 0; // expected-error {{must be initialized by a constant expression}} |
| 289 | |
| 290 | static_assert_fold(&x == &x, ""); |
| 291 | static_assert_fold(&x != &x, "false"); // expected-error {{false}} |
| 292 | static_assert_fold(&x <= &x, ""); |
| 293 | static_assert_fold(&x >= &x, ""); |
| 294 | static_assert_fold(&x < &x, "false"); // expected-error {{false}} |
| 295 | static_assert_fold(&x > &x, "false"); // expected-error {{false}} |
| 296 | |
| 297 | constexpr S* sptr = &s; |
| 298 | // FIXME: This is not a constant expression; check we reject this and move this |
| 299 | // test elsewhere. |
| 300 | constexpr bool dyncast = sptr == dynamic_cast<S*>(sptr); |
| 301 | |
| 302 | extern char externalvar[]; |
| 303 | // FIXME: This is not a constant expression; check we reject this and move this |
| 304 | // test elsewhere. |
| 305 | constexpr bool constaddress = (void *)externalvar == (void *)0x4000UL; // expected-error {{must be initialized by a constant expression}} |
| 306 | constexpr bool litaddress = "foo" == "foo"; // expected-error {{must be initialized by a constant expression}} expected-warning {{unspecified}} |
| 307 | static_assert_fold(0 != "foo", ""); |
| 308 | |
| 309 | } |
| 310 | |
| 311 | namespace MaterializeTemporary { |
| 312 | |
| 313 | constexpr int f(const int &r) { return r; } |
| 314 | constexpr int n = f(1); |
| 315 | |
| 316 | constexpr bool same(const int &a, const int &b) { return &a == &b; } |
| 317 | constexpr bool sameTemporary(const int &n) { return same(n, n); } |
| 318 | |
| 319 | static_assert_fold(n, ""); |
| 320 | static_assert_fold(!same(4, 4), ""); |
| 321 | static_assert_fold(same(n, n), ""); |
| 322 | static_assert_fold(sameTemporary(9), ""); |
| 323 | |
| 324 | } |
| 325 | |
| 326 | constexpr int strcmp_ce(const char *p, const char *q) { |
| 327 | return (!*p || *p != *q) ? *p - *q : strcmp_ce(p+1, q+1); |
| 328 | } |
| 329 | |
| 330 | namespace StringLiteral { |
| 331 | |
| 332 | // FIXME: Refactor this once we support constexpr templates. |
| 333 | constexpr int MangleChars(const char *p) { |
| 334 | return *p + 3 * (*p ? MangleChars(p+1) : 0); |
| 335 | } |
| 336 | constexpr int MangleChars(const char16_t *p) { |
| 337 | return *p + 3 * (*p ? MangleChars(p+1) : 0); |
| 338 | } |
| 339 | constexpr int MangleChars(const char32_t *p) { |
| 340 | return *p + 3 * (*p ? MangleChars(p+1) : 0); |
| 341 | } |
| 342 | |
| 343 | static_assert_fold(MangleChars("constexpr!") == 1768383, ""); |
| 344 | static_assert_fold(MangleChars(u"constexpr!") == 1768383, ""); |
| 345 | static_assert_fold(MangleChars(U"constexpr!") == 1768383, ""); |
| 346 | |
| 347 | constexpr char c0 = "nought index"[0]; |
| 348 | constexpr char c1 = "nice index"[10]; |
Matt Beaumont-Gay | a5aa96d | 2011-11-24 00:27:38 +0000 | [diff] [blame] | 349 | constexpr char c2 = "nasty index"[12]; // expected-error {{must be initialized by a constant expression}} expected-warning {{is past the end}} |
| 350 | constexpr char c3 = "negative index"[-1]; // expected-error {{must be initialized by a constant expression}} expected-warning {{is before the beginning}} |
Richard Smith | 59efe26 | 2011-11-11 04:05:33 +0000 | [diff] [blame] | 351 | constexpr char c4 = ((char*)(int*)"no reinterpret_casts allowed")[14]; // expected-error {{must be initialized by a constant expression}} |
| 352 | |
| 353 | constexpr const char *p = "test" + 2; |
| 354 | static_assert_fold(*p == 's', ""); |
| 355 | |
| 356 | constexpr const char *max_iter(const char *a, const char *b) { |
| 357 | return *a < *b ? b : a; |
| 358 | } |
| 359 | constexpr const char *max_element(const char *a, const char *b) { |
| 360 | return (a+1 >= b) ? a : max_iter(a, max_element(a+1, b)); |
| 361 | } |
| 362 | |
| 363 | constexpr const char *begin(const char (&arr)[45]) { return arr; } |
| 364 | constexpr const char *end(const char (&arr)[45]) { return arr + 45; } |
| 365 | |
| 366 | constexpr char str[] = "the quick brown fox jumped over the lazy dog"; |
| 367 | constexpr const char *max = max_element(begin(str), end(str)); |
| 368 | static_assert_fold(*max == 'z', ""); |
| 369 | static_assert_fold(max == str + 38, ""); |
| 370 | |
| 371 | static_assert_fold(strcmp_ce("hello world", "hello world") == 0, ""); |
| 372 | static_assert_fold(strcmp_ce("hello world", "hello clang") > 0, ""); |
| 373 | static_assert_fold(strcmp_ce("constexpr", "test") < 0, ""); |
| 374 | static_assert_fold(strcmp_ce("", " ") < 0, ""); |
| 375 | |
| 376 | } |
| 377 | |
| 378 | namespace Array { |
| 379 | |
| 380 | // FIXME: Use templates for these once we support constexpr templates. |
| 381 | constexpr int Sum(const int *begin, const int *end) { |
| 382 | return begin == end ? 0 : *begin + Sum(begin+1, end); |
| 383 | } |
| 384 | constexpr const int *begin(const int (&xs)[5]) { return xs; } |
| 385 | constexpr const int *end(const int (&xs)[5]) { return xs + 5; } |
| 386 | |
| 387 | constexpr int xs[] = { 1, 2, 3, 4, 5 }; |
| 388 | constexpr int ys[] = { 5, 4, 3, 2, 1 }; |
| 389 | constexpr int sum_xs = Sum(begin(xs), end(xs)); |
| 390 | static_assert_fold(sum_xs == 15, ""); |
| 391 | |
| 392 | constexpr int ZipFoldR(int (*F)(int x, int y, int c), int n, |
| 393 | const int *xs, const int *ys, int c) { |
| 394 | return n ? F(*xs, *ys, ZipFoldR(F, n-1, xs+1, ys+1, c)) : c; |
| 395 | } |
| 396 | constexpr int MulAdd(int x, int y, int c) { return x * y + c; } |
| 397 | constexpr int InnerProduct = ZipFoldR(MulAdd, 5, xs, ys, 0); |
| 398 | static_assert_fold(InnerProduct == 35, ""); |
| 399 | |
| 400 | constexpr int SubMul(int x, int y, int c) { return (x - y) * c; } |
| 401 | constexpr int DiffProd = ZipFoldR(SubMul, 2, xs+3, ys+3, 1); |
| 402 | static_assert_fold(DiffProd == 8, ""); |
| 403 | static_assert_fold(ZipFoldR(SubMul, 3, xs+3, ys+3, 1), ""); // expected-error {{constant expression}} |
| 404 | |
| 405 | constexpr const int *p = xs + 3; |
| 406 | constexpr int xs4 = p[1]; // ok |
| 407 | constexpr int xs5 = p[2]; // expected-error {{constant expression}} |
| 408 | constexpr int xs0 = p[-3]; // ok |
| 409 | constexpr int xs_1 = p[-4]; // expected-error {{constant expression}} |
| 410 | |
| 411 | constexpr int zs[2][2][2][2] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }; |
| 412 | static_assert_fold(zs[0][0][0][0] == 1, ""); |
| 413 | static_assert_fold(zs[1][1][1][1] == 16, ""); |
| 414 | static_assert_fold(zs[0][0][0][2] == 3, ""); // expected-error {{constant expression}} |
| 415 | static_assert_fold((&zs[0][0][0][2])[-1] == 2, ""); |
| 416 | static_assert_fold(**(**(zs + 1) + 1) == 11, ""); |
| 417 | static_assert_fold(*(&(&(*(*&(&zs[2] - 1)[0] + 2 - 2))[2])[-1][-1] + 1) == 11, ""); |
| 418 | |
| 419 | constexpr int arr[40] = { 1, 2, 3, [8] = 4 }; |
| 420 | constexpr int SumNonzero(const int *p) { |
| 421 | return *p + (*p ? SumNonzero(p+1) : 0); |
| 422 | } |
| 423 | constexpr int CountZero(const int *p, const int *q) { |
| 424 | return p == q ? 0 : (*p == 0) + CountZero(p+1, q); |
| 425 | } |
| 426 | static_assert_fold(SumNonzero(arr) == 6, ""); |
| 427 | static_assert_fold(CountZero(arr, arr + 40) == 36, ""); |
| 428 | |
Richard Smith | e24f5fc | 2011-11-17 22:56:20 +0000 | [diff] [blame] | 429 | struct ArrayElem { |
| 430 | constexpr ArrayElem() : n(0) {} |
| 431 | int n; |
| 432 | constexpr int f() { return n; } |
| 433 | }; |
| 434 | struct ArrayRVal { |
| 435 | constexpr ArrayRVal() {} |
| 436 | ArrayElem elems[10]; |
| 437 | }; |
| 438 | static_assert_fold(ArrayRVal().elems[3].f() == 0, ""); |
| 439 | |
Richard Smith | 59efe26 | 2011-11-11 04:05:33 +0000 | [diff] [blame] | 440 | } |
| 441 | |
| 442 | namespace DependentValues { |
| 443 | |
| 444 | struct I { int n; typedef I V[10]; }; |
| 445 | I::V x, y; |
| 446 | template<bool B> struct S { |
| 447 | int k; |
| 448 | void f() { |
| 449 | I::V &cells = B ? x : y; |
| 450 | I &i = cells[k]; |
| 451 | switch (i.n) {} |
| 452 | } |
| 453 | }; |
| 454 | |
| 455 | } |
| 456 | |
| 457 | namespace Class { |
| 458 | |
| 459 | struct A { constexpr A(int a, int b) : k(a + b) {} int k; }; |
| 460 | constexpr int fn(const A &a) { return a.k; } |
| 461 | static_assert_fold(fn(A(4,5)) == 9, ""); |
| 462 | |
| 463 | struct B { int n; int m; } constexpr b = { 0, b.n }; // expected-warning {{uninitialized}} |
| 464 | struct C { |
| 465 | constexpr C(C *this_) : m(42), n(this_->m) {} // ok |
| 466 | int m, n; |
| 467 | }; |
| 468 | struct D { |
| 469 | C c; |
| 470 | constexpr D() : c(&c) {} |
| 471 | }; |
| 472 | static_assert_fold(D().c.n == 42, ""); |
| 473 | |
| 474 | struct E { |
| 475 | constexpr E() : p(&p) {} |
| 476 | void *p; |
| 477 | }; |
| 478 | constexpr const E &e1 = E(); // expected-error {{constant expression}} |
| 479 | // This is a constant expression if we elide the copy constructor call, and |
| 480 | // is not a constant expression if we don't! But we do, so it is. |
| 481 | // FIXME: The move constructor is not currently implicitly defined as constexpr. |
| 482 | // We notice this when evaluating an expression which uses it, but not when |
| 483 | // checking its initializer. |
| 484 | constexpr E e2 = E(); // unexpected-error {{constant expression}} |
| 485 | static_assert_fold(e2.p == &e2.p, ""); // unexpected-error {{constant expression}} |
| 486 | // FIXME: We don't pass through the fact that 'this' is ::e3 when checking the |
| 487 | // initializer of this declaration. |
| 488 | constexpr E e3; // unexpected-error {{constant expression}} |
| 489 | static_assert_fold(e3.p == &e3.p, ""); |
| 490 | |
| 491 | extern const class F f; |
| 492 | struct F { |
| 493 | constexpr F() : p(&f.p) {} |
| 494 | const void *p; |
| 495 | }; |
| 496 | constexpr F f = F(); |
| 497 | |
| 498 | struct G { |
| 499 | struct T { |
| 500 | constexpr T(T *p) : u1(), u2(p) {} |
| 501 | union U1 { |
| 502 | constexpr U1() {} |
| 503 | int a, b = 42; |
| 504 | } u1; |
| 505 | union U2 { |
| 506 | constexpr U2(T *p) : c(p->u1.b) {} |
| 507 | int c, d; |
| 508 | } u2; |
| 509 | } t; |
| 510 | constexpr G() : t(&t) {} |
| 511 | } constexpr g; |
| 512 | |
| 513 | static_assert_fold(g.t.u1.a == 42, ""); // expected-error {{constant expression}} |
| 514 | static_assert_fold(g.t.u1.b == 42, ""); |
| 515 | static_assert_fold(g.t.u2.c == 42, ""); |
| 516 | static_assert_fold(g.t.u2.d == 42, ""); // expected-error {{constant expression}} |
| 517 | |
| 518 | struct S { |
| 519 | int a, b; |
| 520 | const S *p; |
| 521 | double d; |
| 522 | const char *q; |
| 523 | |
| 524 | constexpr S(int n, const S *p) : a(5), b(n), p(p), d(n), q("hello") {} |
| 525 | }; |
| 526 | |
| 527 | S global(43, &global); |
| 528 | |
| 529 | static_assert_fold(S(15, &global).b == 15, ""); |
| 530 | |
| 531 | constexpr bool CheckS(const S &s) { |
| 532 | return s.a == 5 && s.b == 27 && s.p == &global && s.d == 27. && s.q[3] == 'l'; |
| 533 | } |
| 534 | static_assert_fold(CheckS(S(27, &global)), ""); |
| 535 | |
| 536 | struct Arr { |
| 537 | char arr[3]; |
| 538 | constexpr Arr() : arr{'x', 'y', 'z'} {} |
| 539 | }; |
| 540 | constexpr int hash(Arr &&a) { |
| 541 | return a.arr[0] + a.arr[1] * 0x100 + a.arr[2] * 0x10000; |
| 542 | } |
| 543 | constexpr int k = hash(Arr()); |
| 544 | static_assert_fold(k == 0x007a7978, ""); |
| 545 | |
| 546 | |
| 547 | struct AggregateInit { |
| 548 | const char &c; |
| 549 | int n; |
| 550 | double d; |
| 551 | int arr[5]; |
| 552 | void *p; |
| 553 | }; |
| 554 | |
| 555 | constexpr AggregateInit agg1 = { "hello"[0] }; |
| 556 | |
| 557 | static_assert_fold(strcmp_ce(&agg1.c, "hello") == 0, ""); |
| 558 | static_assert_fold(agg1.n == 0, ""); |
| 559 | static_assert_fold(agg1.d == 0.0, ""); |
| 560 | static_assert_fold(agg1.arr[-1] == 0, ""); // expected-error {{constant expression}} |
| 561 | static_assert_fold(agg1.arr[0] == 0, ""); |
| 562 | static_assert_fold(agg1.arr[4] == 0, ""); |
| 563 | static_assert_fold(agg1.arr[5] == 0, ""); // expected-error {{constant expression}} |
| 564 | static_assert_fold(agg1.p == nullptr, ""); |
| 565 | |
| 566 | namespace SimpleDerivedClass { |
| 567 | |
| 568 | struct B { |
| 569 | constexpr B(int n) : a(n) {} |
| 570 | int a; |
| 571 | }; |
| 572 | struct D : B { |
| 573 | constexpr D(int n) : B(n) {} |
| 574 | }; |
| 575 | constexpr D d(3); |
| 576 | static_assert_fold(d.a == 3, ""); |
| 577 | |
| 578 | } |
| 579 | |
Richard Smith | e24f5fc | 2011-11-17 22:56:20 +0000 | [diff] [blame] | 580 | struct Bottom { constexpr Bottom() {} }; |
| 581 | struct Base : Bottom { |
Richard Smith | 59efe26 | 2011-11-11 04:05:33 +0000 | [diff] [blame] | 582 | constexpr Base(int a = 42, const char *b = "test") : a(a), b(b) {} |
| 583 | int a; |
| 584 | const char *b; |
| 585 | }; |
Richard Smith | e24f5fc | 2011-11-17 22:56:20 +0000 | [diff] [blame] | 586 | struct Base2 : Bottom { |
Richard Smith | 59efe26 | 2011-11-11 04:05:33 +0000 | [diff] [blame] | 587 | constexpr Base2(const int &r) : r(r) {} |
| 588 | int q = 123; |
| 589 | // FIXME: When we track the global for which we are computing the initializer, |
| 590 | // use a reference here. |
| 591 | //const int &r; |
| 592 | int r; |
| 593 | }; |
| 594 | struct Derived : Base, Base2 { |
| 595 | constexpr Derived() : Base(76), Base2(a) {} |
| 596 | int c = r + b[1]; |
| 597 | }; |
| 598 | |
| 599 | constexpr bool operator==(const Base &a, const Base &b) { |
| 600 | return a.a == b.a && strcmp_ce(a.b, b.b) == 0; |
| 601 | } |
| 602 | |
| 603 | constexpr Base base; |
| 604 | constexpr Base base2(76); |
| 605 | constexpr Derived derived; |
| 606 | static_assert_fold(derived.a == 76, ""); |
| 607 | static_assert_fold(derived.b[2] == 's', ""); |
| 608 | static_assert_fold(derived.c == 76 + 'e', ""); |
| 609 | static_assert_fold(derived.q == 123, ""); |
| 610 | static_assert_fold(derived.r == 76, ""); |
| 611 | static_assert_fold(&derived.r == &derived.a, ""); // expected-error {{}} |
| 612 | |
| 613 | static_assert_fold(!(derived == base), ""); |
| 614 | static_assert_fold(derived == base2, ""); |
| 615 | |
Richard Smith | e24f5fc | 2011-11-17 22:56:20 +0000 | [diff] [blame] | 616 | constexpr Bottom &bot1 = (Base&)derived; |
| 617 | constexpr Bottom &bot2 = (Base2&)derived; |
| 618 | static_assert_fold(&bot1 != &bot2, ""); |
| 619 | |
| 620 | constexpr Bottom *pb1 = (Base*)&derived; |
| 621 | constexpr Bottom *pb2 = (Base2*)&derived; |
| 622 | static_assert_fold(pb1 != pb2, ""); |
| 623 | static_assert_fold(pb1 == &bot1, ""); |
| 624 | static_assert_fold(pb2 == &bot2, ""); |
| 625 | |
| 626 | constexpr Base2 &fail = (Base2&)bot1; // expected-error {{constant expression}} |
| 627 | constexpr Base &fail2 = (Base&)*pb2; // expected-error {{constant expression}} |
| 628 | constexpr Base2 &ok2 = (Base2&)bot2; |
| 629 | static_assert_fold(&ok2 == &derived, ""); |
| 630 | |
| 631 | constexpr Base2 *pfail = (Base2*)pb1; // expected-error {{constant expression}} |
| 632 | constexpr Base *pfail2 = (Base*)&bot2; // expected-error {{constant expression}} |
| 633 | constexpr Base2 *pok2 = (Base2*)pb2; |
| 634 | static_assert_fold(pok2 == &derived, ""); |
| 635 | static_assert_fold(&ok2 == pok2, ""); |
| 636 | static_assert_fold((Base2*)(Derived*)(Base*)pb1 == pok2, ""); |
| 637 | static_assert_fold((Derived*)(Base*)pb1 == (Derived*)pok2, ""); |
| 638 | |
| 639 | constexpr Base *nullB = 42 - 6 * 7; |
| 640 | static_assert_fold((Bottom*)nullB == 0, ""); |
| 641 | static_assert_fold((Derived*)nullB == 0, ""); |
| 642 | static_assert_fold((void*)(Bottom*)nullB == (void*)(Derived*)nullB, ""); |
| 643 | |
| 644 | } |
| 645 | |
| 646 | namespace Temporaries { |
| 647 | |
| 648 | struct S { |
| 649 | constexpr S() {} |
| 650 | constexpr int f(); |
| 651 | }; |
| 652 | struct T : S { |
| 653 | constexpr T(int n) : S(), n(n) {} |
| 654 | int n; |
| 655 | }; |
| 656 | constexpr int S::f() { |
| 657 | // 'this' must be the postfix-expression in a class member access expression, |
| 658 | // so we can't just use |
| 659 | // return static_cast<T*>(this)->n; |
| 660 | return this->*(int(S::*))&T::n; |
| 661 | } |
| 662 | // The T temporary is implicitly cast to an S subobject, but we can recover the |
| 663 | // T full-object via a base-to-derived cast, or a derived-to-base-casted member |
| 664 | // pointer. |
| 665 | static_assert_fold(T(3).f() == 3, ""); |
| 666 | |
| 667 | constexpr int f(const S &s) { |
| 668 | return static_cast<const T&>(s).n; |
| 669 | } |
| 670 | constexpr int n = f(T(5)); |
| 671 | static_assert_fold(f(T(5)) == 5, ""); |
| 672 | |
Richard Smith | 59efe26 | 2011-11-11 04:05:33 +0000 | [diff] [blame] | 673 | } |
| 674 | |
| 675 | namespace Union { |
| 676 | |
| 677 | union U { |
| 678 | int a; |
| 679 | int b; |
| 680 | }; |
| 681 | |
| 682 | constexpr U u[4] = { { .a = 0 }, { .b = 1 }, { .a = 2 }, { .b = 3 } }; |
| 683 | static_assert_fold(u[0].a == 0, ""); |
| 684 | static_assert_fold(u[0].b, ""); // expected-error {{constant expression}} |
| 685 | static_assert_fold(u[1].b == 1, ""); |
| 686 | static_assert_fold((&u[1].b)[1] == 2, ""); // expected-error {{constant expression}} |
| 687 | static_assert_fold(*(&(u[1].b) + 1 + 1) == 3, ""); // expected-error {{constant expression}} |
| 688 | static_assert_fold((&(u[1]) + 1 + 1)->b == 3, ""); |
| 689 | |
| 690 | } |
| 691 | |
Richard Smith | e24f5fc | 2011-11-17 22:56:20 +0000 | [diff] [blame] | 692 | namespace MemberPointer { |
| 693 | struct A { |
| 694 | constexpr A(int n) : n(n) {} |
| 695 | int n; |
| 696 | constexpr int f() { return n + 3; } |
| 697 | }; |
| 698 | constexpr A a(7); |
| 699 | static_assert_fold(A(5).*&A::n == 5, ""); |
| 700 | static_assert_fold((&a)->*&A::n == 7, ""); |
| 701 | static_assert_fold((A(8).*&A::f)() == 11, ""); |
| 702 | static_assert_fold(((&a)->*&A::f)() == 10, ""); |
| 703 | |
| 704 | struct B : A { |
| 705 | constexpr B(int n, int m) : A(n), m(m) {} |
| 706 | int m; |
| 707 | constexpr int g() { return n + m + 1; } |
| 708 | }; |
| 709 | constexpr B b(9, 13); |
| 710 | static_assert_fold(B(4, 11).*&A::n == 4, ""); |
| 711 | static_assert_fold(B(4, 11).*&B::m == 11, ""); |
| 712 | static_assert_fold(B(4, 11).*(int(A::*))&B::m == 11, ""); |
| 713 | static_assert_fold((&b)->*&A::n == 9, ""); |
| 714 | static_assert_fold((&b)->*&B::m == 13, ""); |
| 715 | static_assert_fold((&b)->*(int(A::*))&B::m == 13, ""); |
| 716 | static_assert_fold((B(4, 11).*&A::f)() == 7, ""); |
| 717 | static_assert_fold((B(4, 11).*&B::g)() == 16, ""); |
| 718 | static_assert_fold((B(4, 11).*(int(A::*)()const)&B::g)() == 16, ""); |
| 719 | static_assert_fold(((&b)->*&A::f)() == 12, ""); |
| 720 | static_assert_fold(((&b)->*&B::g)() == 23, ""); |
| 721 | static_assert_fold(((&b)->*(int(A::*)()const)&B::g)() == 23, ""); |
| 722 | |
| 723 | struct S { |
| 724 | constexpr S(int m, int n, int (S::*pf)() const, int S::*pn) : |
| 725 | m(m), n(n), pf(pf), pn(pn) {} |
| 726 | constexpr S() : m(), n(), pf(&S::f), pn(&S::n) {} |
| 727 | |
| 728 | constexpr int f() { return this->*pn; } |
| 729 | virtual int g() const; |
| 730 | |
| 731 | int m, n; |
| 732 | int (S::*pf)() const; |
| 733 | int S::*pn; |
| 734 | }; |
| 735 | |
| 736 | constexpr int S::*pm = &S::m; |
| 737 | constexpr int S::*pn = &S::n; |
| 738 | constexpr int (S::*pf)() const = &S::f; |
| 739 | constexpr int (S::*pg)() const = &S::g; |
| 740 | |
| 741 | constexpr S s(2, 5, &S::f, &S::m); |
| 742 | |
| 743 | static_assert_fold((s.*&S::f)() == 2, ""); |
| 744 | static_assert_fold((s.*s.pf)() == 2, ""); |
| 745 | |
| 746 | template<int n> struct T : T<n-1> {}; |
| 747 | template<> struct T<0> { int n; }; |
| 748 | template<> struct T<30> : T<29> { int m; }; |
| 749 | |
| 750 | T<17> t17; |
| 751 | T<30> t30; |
| 752 | |
| 753 | constexpr int (T<10>::*deepn) = &T<0>::n; |
| 754 | static_assert_fold(&(t17.*deepn) == &t17.n, ""); |
| 755 | |
| 756 | constexpr int (T<15>::*deepm) = (int(T<10>::*))&T<30>::m; |
| 757 | constexpr int *pbad = &(t17.*deepm); // expected-error {{constant expression}} |
| 758 | static_assert_fold(&(t30.*deepm) == &t30.m, ""); |
| 759 | |
| 760 | constexpr T<5> *p17_5 = &t17; |
| 761 | constexpr T<13> *p17_13 = (T<13>*)p17_5; |
| 762 | constexpr T<23> *p17_23 = (T<23>*)p17_13; // expected-error {{constant expression}} |
| 763 | static_assert_fold(&(p17_5->*(int(T<3>::*))deepn) == &t17.n, ""); |
| 764 | static_assert_fold(&(p17_13->*deepn) == &t17.n, ""); |
| 765 | constexpr int *pbad2 = &(p17_13->*(int(T<9>::*))deepm); // expected-error {{constant expression}} |
| 766 | |
| 767 | constexpr T<5> *p30_5 = &t30; |
| 768 | constexpr T<23> *p30_23 = (T<23>*)p30_5; |
| 769 | constexpr T<13> *p30_13 = p30_23; |
| 770 | static_assert_fold(&(p30_5->*(int(T<3>::*))deepn) == &t30.n, ""); |
| 771 | static_assert_fold(&(p30_13->*deepn) == &t30.n, ""); |
| 772 | static_assert_fold(&(p30_23->*deepn) == &t30.n, ""); |
| 773 | static_assert_fold(&(p30_5->*(int(T<2>::*))deepm) == &t30.m, ""); |
| 774 | static_assert_fold(&(((T<17>*)p30_13)->*deepm) == &t30.m, ""); |
| 775 | static_assert_fold(&(p30_23->*deepm) == &t30.m, ""); |
| 776 | } |
| 777 | |
| 778 | namespace ArrayBaseDerived { |
| 779 | |
| 780 | struct Base { |
| 781 | constexpr Base() {} |
| 782 | int n = 0; |
| 783 | }; |
| 784 | struct Derived : Base { |
| 785 | constexpr Derived() {} |
| 786 | constexpr const int *f() { return &n; } |
| 787 | }; |
| 788 | |
| 789 | constexpr Derived a[10]; |
| 790 | constexpr Derived *pd3 = const_cast<Derived*>(&a[3]); |
| 791 | constexpr Base *pb3 = const_cast<Derived*>(&a[3]); |
| 792 | static_assert_fold(pb3 == pd3, ""); |
| 793 | |
| 794 | // pb3 does not point to an array element. |
| 795 | constexpr Base *pb4 = pb3 + 1; // ok, one-past-the-end pointer. |
| 796 | constexpr int pb4n = pb4->n; // expected-error {{constant expression}} |
| 797 | constexpr Base *err_pb5 = pb3 + 2; // FIXME: reject this. |
| 798 | constexpr int err_pb5n = err_pb5->n; // expected-error {{constant expression}} |
| 799 | constexpr Base *err_pb2 = pb3 - 1; // FIXME: reject this. |
| 800 | constexpr int err_pb2n = err_pb2->n; // expected-error {{constant expression}} |
| 801 | constexpr Base *pb3a = pb4 - 1; |
| 802 | |
| 803 | // pb4 does not point to a Derived. |
| 804 | constexpr Derived *err_pd4 = (Derived*)pb4; // expected-error {{constant expression}} |
| 805 | constexpr Derived *pd3a = (Derived*)pb3a; |
| 806 | constexpr int pd3n = pd3a->n; |
| 807 | |
| 808 | // pd3a still points to the Derived array. |
| 809 | constexpr Derived *pd6 = pd3a + 3; |
| 810 | static_assert_fold(pd6 == &a[6], ""); |
| 811 | constexpr Derived *pd9 = pd6 + 3; |
| 812 | constexpr Derived *pd10 = pd6 + 4; |
| 813 | constexpr int pd9n = pd9->n; // ok |
| 814 | constexpr int err_pd10n = pd10->n; // expected-error {{constant expression}} |
| 815 | constexpr int pd0n = pd10[-10].n; |
| 816 | constexpr int err_pdminus1n = pd10[-11].n; // expected-error {{constant expression}} |
| 817 | |
| 818 | constexpr Base *pb9 = pd9; |
| 819 | constexpr const int *(Base::*pfb)() const = |
| 820 | static_cast<const int *(Base::*)() const>(&Derived::f); |
| 821 | static_assert_fold((pb9->*pfb)() == &a[9].n, ""); |
| 822 | } |
| 823 | |
Richard Smith | 59efe26 | 2011-11-11 04:05:33 +0000 | [diff] [blame] | 824 | namespace Complex { |
| 825 | |
| 826 | class complex { |
| 827 | int re, im; |
| 828 | public: |
| 829 | constexpr complex(int re = 0, int im = 0) : re(re), im(im) {} |
| 830 | constexpr complex(const complex &o) : re(o.re), im(o.im) {} |
| 831 | constexpr complex operator-() const { return complex(-re, -im); } |
| 832 | friend constexpr complex operator+(const complex &l, const complex &r) { |
| 833 | return complex(l.re + r.re, l.im + r.im); |
| 834 | } |
| 835 | friend constexpr complex operator-(const complex &l, const complex &r) { |
| 836 | return l + -r; |
| 837 | } |
| 838 | friend constexpr complex operator*(const complex &l, const complex &r) { |
| 839 | return complex(l.re * r.re - l.im * r.im, l.re * r.im + l.im * r.re); |
| 840 | } |
| 841 | friend constexpr bool operator==(const complex &l, const complex &r) { |
| 842 | return l.re == r.re && l.im == r.im; |
| 843 | } |
| 844 | constexpr bool operator!=(const complex &r) const { |
| 845 | return re != r.re || im != r.im; |
| 846 | } |
| 847 | constexpr int real() const { return re; } |
| 848 | constexpr int imag() const { return im; } |
| 849 | }; |
| 850 | |
| 851 | constexpr complex i = complex(0, 1); |
| 852 | constexpr complex k = (3 + 4*i) * (6 - 4*i); |
| 853 | static_assert_fold(complex(1,0).real() == 1, ""); |
| 854 | static_assert_fold(complex(1,0).imag() == 0, ""); |
| 855 | static_assert_fold(((complex)1).imag() == 0, ""); |
| 856 | static_assert_fold(k.real() == 34, ""); |
| 857 | static_assert_fold(k.imag() == 12, ""); |
| 858 | static_assert_fold(k - 34 == 12*i, ""); |
| 859 | static_assert_fold((complex)1 == complex(1), ""); |
| 860 | static_assert_fold((complex)1 != complex(0, 1), ""); |
| 861 | static_assert_fold(complex(1) == complex(1), ""); |
| 862 | static_assert_fold(complex(1) != complex(0, 1), ""); |
| 863 | constexpr complex makeComplex(int re, int im) { return complex(re, im); } |
| 864 | static_assert_fold(makeComplex(1,0) == complex(1), ""); |
| 865 | static_assert_fold(makeComplex(1,0) != complex(0, 1), ""); |
| 866 | |
| 867 | class complex_wrap : public complex { |
| 868 | public: |
| 869 | constexpr complex_wrap(int re, int im = 0) : complex(re, im) {} |
| 870 | constexpr complex_wrap(const complex_wrap &o) : complex(o) {} |
| 871 | }; |
| 872 | |
| 873 | static_assert_fold((complex_wrap)1 == complex(1), ""); |
| 874 | static_assert_fold((complex)1 != complex_wrap(0, 1), ""); |
| 875 | static_assert_fold(complex(1) == complex_wrap(1), ""); |
| 876 | static_assert_fold(complex_wrap(1) != complex(0, 1), ""); |
| 877 | constexpr complex_wrap makeComplexWrap(int re, int im) { |
| 878 | return complex_wrap(re, im); |
| 879 | } |
| 880 | static_assert_fold(makeComplexWrap(1,0) == complex(1), ""); |
| 881 | static_assert_fold(makeComplexWrap(1,0) != complex(0, 1), ""); |
| 882 | |
| 883 | } |