Lines Matching refs:static_assert
17 static_assert(&s.get(4) - &sr.get(2) == 2, "");
21 static_assert(e() == 5, "");
35 static_assert(f() == 1, "");
44 static_assert(g(2) == 42, "");
67 static_assert(j(0) == -3, "");
68 static_assert(j(1) == 5, "");
69 static_assert(j(2), ""); // expected-error {{constant expression}} expected-note {{in call to 'j(2)…
70 static_assert(j(3) == 3, "");
71 static_assert(j(4) == 5, "");
72 static_assert(j(5) == 1, "");
99 static_assert(l(false) == 5, "");
100 static_assert(l(true), ""); // expected-error {{constant expression}} expected-note {{in call to 'l…
141 …static_assert((set(a, 1), a) == 1, ""); // expected-error {{constant expression}} expected-note {{…
142 …static_assert((set(b, 1), b) == 1, ""); // expected-error {{constant expression}} expected-note {{…
143 …static_assert((set(c, 1), c) == 1, ""); // expected-error {{constant expression}} expected-note {{…
145 static_assert(wrap(a, 1) == 1, "");
146 static_assert(wrap(b, 1) == 1, "");
147 …static_assert(wrap(c, 1) == 1, ""); // expected-error {{constant expression}} expected-note {{read…
175 static_assert(!test1(1), "");
176 static_assert(test1(3), "");
177 static_assert(!test1(6), "");
178 static_assert(test1(9), "");
179 static_assert(!test1(100), "");
180 …static_assert(!test1(101), ""); // expected-error {{constant expression}} expected-note {{in call …
196 static_assert(do_stuff(1, 2) == 3, "");
197 static_assert(do_stuff(0, 0) == 5, "");
198 static_assert(do_stuff(1233, 1233) == 5, "");
199 static_assert(do_stuff(1233, 0) == 1, "");
200 …static_assert(do_stuff(1234, 0) == 1, ""); // expected-error {{constant expression}} expected-note…
201 …static_assert(do_stuff(1235, 0) == 1, ""); // expected-error {{constant expression}} expected-note…
202 …static_assert(do_stuff(-1, 0) == 1, ""); // expected-error {{constant expression}} expected-note {…
232 static_assert(g(), "");
236 static_assert(h(), ""); // expected-error {{constant expression}} expected-note {{in call}}
239 static_assert(i(), ""); // expected-error {{constant expression}} expected-note {{in call}}
242 static_assert(j(), ""); // expected-error {{constant expression}} expected-note {{in call}}
249 static_assert(bad(), ""); // expected-error {{constant expression}} expected-note {{in call}}
256 static_assert(test1() == 1, "");
257 …static_assert(test2() == 1, ""); // expected-error {{constant expression}} expected-note {{in call…
265 static_assert(test(0), ""); // expected-error {{constant expression}} expected-note {{in call}}
273 static_assert(++ref(0) == 1, "");
274 static_assert(ref(0)++ == 0, "");
275 static_assert(postinc(0) == 1, "");
276 static_assert(--ref(0) == -1, "");
277 static_assert(ref(0)-- == 0, "");
278 static_assert(postdec(0) == -1, "");
286 static_assert(++ref<short>(0x7fff) == (int)0xffff8000u, "");
287 static_assert(--ref<short>(0x8000) == 0x7fff, "");
290 static_assert(++ref(false), ""); // expected-warning {{deprecated}}
291 static_assert(++ref(true), ""); // expected-warning {{deprecated}}
294 static_assert(++ref(&arr[0]) == &arr[1], "");
295 static_assert(++ref(&arr[9]) == &arr[10], "");
296 …static_assert(++ref(&arr[10]) == &arr[11], ""); // expected-error {{constant}} expected-note {{can…
297 static_assert(ref(&arr[0])++ == &arr[0], "");
298 …static_assert(ref(&arr[10])++ == &arr[10], ""); // expected-error {{constant}} expected-note {{can…
299 static_assert(postinc(&arr[0]) == &arr[1], "");
300 static_assert(--ref(&arr[10]) == &arr[9], "");
301 static_assert(--ref(&arr[1]) == &arr[0], "");
302 …static_assert(--ref(&arr[0]) != &arr[0], ""); // expected-error {{constant}} expected-note {{canno…
303 static_assert(ref(&arr[1])-- == &arr[1], "");
304 …static_assert(ref(&arr[0])-- == &arr[0], ""); // expected-error {{constant}} expected-note {{canno…
305 static_assert(postdec(&arr[1]) == &arr[0], "");
308 static_assert(++ref(&x) == &x + 1, "");
310 static_assert(++ref(0.0) == 1.0, "");
311 static_assert(ref(0.0)++ == 0.0, "");
312 static_assert(postinc(0.0) == 1.0, "");
313 static_assert(--ref(0.0) == -1.0, "");
314 static_assert(ref(0.0)-- == 0.0, "");
315 static_assert(postdec(0.0) == -1.0, "");
317 static_assert(++ref(1e100) == 1e100, "");
318 static_assert(--ref(1e100) == 1e100, "");
335 static_assert(incr(0) == 101, "");
363 static_assert(test_int(), "");
377 static_assert(test_float(), "");
392 static_assert(test_ptr(), "");
402 static_assert(test_overflow<int>(), ""); // expected-error {{constant}} expected-note {{call}}
403 static_assert(test_overflow<unsigned>(), ""); // ok, unsigned overflow is defined
404 static_assert(test_overflow<short>(), ""); // ok, short is promoted to int before multiplication
405 static_assert(test_overflow<unsigned short>(), ""); // ok
406 static_assert(test_overflow<unsigned long long>(), ""); // ok
407 …static_assert(test_overflow<long long>(), ""); // expected-error {{constant}} expected-note {{call…
408 static_assert(test_overflow<float>(), ""); // expected-error {{constant}} expected-note {{call}}
415 static_assert(test_promotion(100) == 10000, "");
416 static_assert(test_promotion(200) == -25536, "");
417 static_assert(test_promotion(256) == 0, "");
422 static_assert(test_bounds("foo", 0)[0] == 'f', "");
423 static_assert(test_bounds("foo", 3)[0] == 0, "");
424 static_assert(test_bounds("foo", 4)[-3] == 'o', "");
425 static_assert(test_bounds("foo" + 4, -4)[0] == 'f', "");
426 …static_assert(test_bounds("foo", 5) != 0, ""); // expected-error {{constant}} expected-note {{call…
427 …static_assert(test_bounds("foo", -1) != 0, ""); // expected-error {{constant}} expected-note {{cal…
428 …static_assert(test_bounds("foo", 1000) != 0, ""); // expected-error {{constant}} expected-note {{c…
441 static_assert(fib_loop(46) == 1836311903, "");
467 static_assert(breaks_work(), "");
485 static_assert(no_cont_after_break(), "");
498 static_assert(cond(), "");
507 static_assert(range_for() == 15, "");
552 static_assert(range_for_2() == 10, "");
575 static_assert(testA(), "");
595 static_assert(testC(), "");
636 static_assert(f(0) == 0, "");
637 static_assert(f(1) == 1, "");
638 static_assert(f(2) == 2, "");
639 static_assert(f(3) == 3, "");
640 static_assert(f(4) == 4, "");
641 static_assert(f(5) == 5, "");
642 static_assert(f(6) == 6, "");
643 static_assert(f(7) == 7, "");
644 static_assert(f(8) == 8, "");
645 static_assert(f(9) == 9, "");
646 static_assert(f(10) == 10, "");
663 static_assert(contin(), "");
675 static_assert(switch_into_for(), "");
701 static_assert(test_copy("foo", 0), "");
702 static_assert(test_copy("foo", 1), "");
703 static_assert(test_copy("foo", 2), "");
704 static_assert(test_copy("hello world", 0), "");
705 static_assert(test_copy("hello world", 7), "");
706 static_assert(test_copy("hello world", 8), "");
707 static_assert(test_copy("hello world", 9), "");
708 static_assert(test_copy("hello world", 10), "");
709 static_assert(test_copy("hello world", 10), "");
715 static_assert(f() == 0, "");
716 static_assert(g(true), "");
723 static_assert(a.x == 42, "");
724 static_assert(a.y == 54, "");
765 static_assert(sum({1, 2, 3, 4, 5}) == 15, "");
780 static_assert(f(1) == 1, ""); // expected-error {{constant expression}} expected-note {{in call}}
809 static_assert(p->f() == sizeof(S1), "");
814 …static_assert(q->f() == sizeof(X<S2>), ""); // expected-error {{constant expression}} expected-not…
823 static_assert(f() == 123, ""); // expected-error {{constant expression}} expected-note {{in call}}
835 static_assert(g() == 42, ""); // expected-error {{constant expression}} expected-note {{in call}}
852 static_assert(h(0) == 0, ""); // ok, lifetime-extended
853 static_assert(h(1) == 0, ""); // expected-error {{constant expression}} expected-note {{in call}}
854 static_assert(h(2) == 0, ""); // expected-error {{constant expression}} expected-note {{in call}}
855 static_assert(h(3) == 0, ""); // expected-error {{constant expression}} expected-note {{in call}}
870 static_assert((lifetime_versus_loops(), true), "");
887 static_assert(test(), "");
911 static_assert(sum(ARR) == 15, "");