• Home
  • Raw
  • Download

Lines Matching refs:constexpr

5   constexpr S(int);
11 constexpr int &get(int n) { return arr[n]; } in get()
12 constexpr const int &get(int n) const { return arr[n]; } in get()
20 constexpr int e() {{{{}} return 5; }} in e()
24 constexpr int f() { in f()
28 constexpr S(E e) : e(e) {} in f()
29 constexpr int get() { return e; } in f()
38 constexpr int g(int k) { in g()
45 constexpr int h(int n) { in h()
49 constexpr int i(int n) { in i()
55 constexpr int j(int k) { in j()
75 constexpr void k() { in k()
80 [[noreturn]] constexpr int fn() { // expected-error {{no return statement in constexpr function}} in fn()
86 constexpr U(int n) { in U()
90 constexpr U u1{1};
91 constexpr U u2{2}; // expected-error {{constant expression}} expected-note {{in call to 'U(2)'}}
94 constexpr int l(bool b) { in l()
103 constexpr int htonl(int x) { // expected-error {{never produces a constant expression}} in htonl()
109 constexpr int maybe_htonl(bool isBigEndian, int x) { in maybe_htonl()
118 constexpr int swapped = maybe_htonl(false, 123); // expected-error {{constant expression}} expected…
121 constexpr int n = 0;
123 constexpr int namespace_alias() { in namespace_alias()
129 constexpr int a = 0;
133 constexpr void set(const int &a, int b) { in set()
136 constexpr int wrap(int a, int b) { in wrap()
152 constexpr void swap(T &a, T &b) { in swap()
158 constexpr void reverse(Iterator begin, Iterator end) { in reverse()
163 constexpr bool equal(Iterator1 a, Iterator1 ae, Iterator2 b, Iterator2 be) { in equal()
169 constexpr bool test1(int n) { in test1()
182constexpr void f() { // expected-error{{constexpr function never produces a constant expression}} … in f()
189 constexpr int do_stuff(int k1, int k2) { in do_stuff()
204 constexpr void set(int &n) { n = 1; } in set()
205 constexpr int div_zero_1() { int z = 0; set(z); return 100 / z; } // no error in div_zero_1()
206 constexpr int div_zero_2() { // expected-error {{never produces a constant expression}} in div_zero_2()
211 constexpr int ref() { // expected-error {{never produces a constant expression}} in ref()
218 union A { constexpr A() : y(5) {} int x, y; }; in A()
221 union D { constexpr D() : c() {} constexpr D(int n) : n(n) {} C c; int n; }; in D()
222 constexpr void f(D &d) { in f()
227 constexpr bool check(D &d) { return d.c.a.y == 3; } in check()
229 constexpr bool g() { D d; f(d); return d.c.a.y == 3; } in g()
233 constexpr bool h() { f(d); return check(d); } // expected-note {{in call}} in h()
236 constexpr bool i() { D d(0); f(d); return check(d); } // expected-note {{in call}} in i()
239constexpr bool j() { D d; d.c.a.x = 3; return check(d); } // expected-note {{assignment to member … in j()
244 constexpr int &&id(int &&n) { return static_cast<int&&>(n); } in id()
245 constexpr int &&dead() { return id(0); } // expected-note {{temporary created here}} in dead()
246constexpr int bad() { int &&n = dead(); n = 1; return n; } // expected-note {{assignment to tempor… in bad()
251constexpr int modify(int &n) { return n = 1; } // expected-note 2 {{modification of object of cons… in modify()
252 constexpr int test1() { int k = 0; return modify(k); } in test1()
253constexpr int test2() { const int k = 0; return modify(const_cast<int&>(k)); } // expected-note 2 … in test2()
256 constexpr int i = test2(); // expected-error {{constant expression}} expected-note {{in call}}
260 constexpr int test(int *p) { in test()
267 template<typename T> constexpr T &ref(T &&r) { return r; } in ref()
268 template<typename T> constexpr T postinc(T &&r) { return (r++, r); } in postinc()
269 template<typename T> constexpr T postdec(T &&r) { return (r--, r); } in postdec()
278constexpr int overflow_int_inc_1 = ref(0x7fffffff)++; // expected-error {{constant}} expected-note…
279 constexpr int overflow_int_inc_1_ok = ref(0x7ffffffe)++;
280constexpr int overflow_int_inc_2 = ++ref(0x7fffffff); // expected-error {{constant}} expected-note…
281 constexpr int overflow_int_inc_2_ok = ++ref(0x7ffffffe);
321 constexpr int f(U u) { in f()
324constexpr int wrong_member = f({0}); // expected-error {{constant}} expected-note {{in call to 'f(…
325constexpr int vol = --ref<volatile int>(0); // expected-error {{constant}} expected-note {{decreme…
327 constexpr int incr(int k) { in incr()
337 constexpr bool test_int() { in test_int()
363 constexpr bool test_float() { in test_float()
377 constexpr bool test_ptr() { in test_ptr()
393 constexpr bool test_overflow() { in test_overflow()
408 constexpr short test_promotion(short k) { in test_promotion()
417 constexpr const char *test_bounds(const char *p, int o) { in test_bounds()
430 constexpr int fib_loop(int a) { in fib_loop()
441 constexpr bool breaks_work() { in breaks_work()
468 constexpr bool no_cont_after_break() { in no_cont_after_break()
485 constexpr bool cond() { in cond()
498 constexpr int range_for() { in range_for()
518 struct ignore { template<typename ...Ts> constexpr ignore(Ts &&...) {} }; in ignore()
521 constexpr array() : arr{} {} in array()
523 constexpr array(X ...x) : arr{} { in array()
526 template<int ...I, typename ...X> constexpr void init(ints<I...>, X ...x) { in init()
532 constexpr explicit iterator(T *p) : p(p) {} in iterator()
533 constexpr bool operator!=(iterator o) { return p != o.p; } in operator !=()
534 constexpr iterator &operator++() { ++p; return *this; } in operator ++()
535 constexpr T &operator*() { return *p; } in operator *()
537 constexpr iterator begin() { return iterator(arr); } in begin()
538 constexpr iterator end() { return iterator(arr + N); } in end()
541 constexpr int range_for_2() { in range_for_2()
555 constexpr A() : n(5) {} in A()
560 constexpr U() : y(4) {} in U()
566 constexpr bool testA() { in testA()
577 constexpr B &operator=(const B&) { in operator =()
586 constexpr bool testC() { in testC()
597 constexpr int f(char k) { in f()
647 constexpr bool contin() { in contin()
663 constexpr bool switch_into_for() { in switch_into_for()
675 constexpr void duff_copy(char *a, const char *b, int n) { in duff_copy()
691 constexpr bool test_copy(const char *str, int n) { in test_copy()
711 constexpr auto f() { return 0; } in f()
712 template<typename T> constexpr auto g(T t) { return t; } in g()
719 constexpr int f(int &r) { r *= 9; return r - 12; } in f()
720 constexpr A a = { 6, f(a.temporary), a.temporary }; // expected-note {{temporary created here}}
723constexpr int k = a.temporary++; // expected-error {{constant expression}} expected-note {{outside…
735 constexpr initializer_list(const _E* __b, size_t __s) in initializer_list()
749 constexpr initializer_list() : __begin_(nullptr), __size_(0) {} in initializer_list()
751 constexpr size_t size() const {return __size_;} in size()
752 constexpr const _E* begin() const {return __begin_;} in begin()
753 constexpr const _E* end() const {return __begin_ + __size_;} in end()
758 constexpr int sum(std::initializer_list<int> ints) { in sum()
767 constexpr int f(int k) { in f()
780 constexpr int g() { // expected-error {{never produces a constant}} in g()
785 constexpr int h() { // expected-error {{never produces a constant}} in h()
799 constexpr X() {} in X()
801 constexpr int f() { return sizeof(T); } in f()
805 constexpr X<X<S1>> xxs1;
806 constexpr X<S1> *p = const_cast<X<X<S1>>*>(&xxs1);
810 constexpr X<X<S2>> xxs2;
811 constexpr X<S2> *q = const_cast<X<X<S2>>*>(&xxs2);
816 constexpr int &get(int &&r) { return r; } in get()
817 constexpr int f() { in f()
823 constexpr int g() { in g()
835 constexpr int h(int n) { in h()
856 constexpr void lifetime_versus_loops() { in lifetime_versus_loops()
877 constexpr bool test() { in test()
891 constexpr A(int &&r) : r(static_cast<int &&>(r)) {} in A()
892 constexpr A() : A(0) { in A()
896 constexpr int k = A().r; // expected-error {{constant expression}} expected-note {{in call to}}
901 constexpr T sum(const T (&arr)[N]) { in sum()
908 constexpr int ARR[] = { 1, 2, 3, 4, 5 };
918 constexpr int f(E &a, int kind) { in f()
926 constexpr int test1 = f(e1, 0);
927constexpr int test2 = f(e2, 0); // expected-error {{constant expression}} expected-note {{in call}}
928 constexpr int test3 = f(e3, 0);
929 constexpr int test4 = f(e1, 1);
930constexpr int test5 = f(e2, 1); // expected-error {{constant expression}} expected-note {{in call}}
931 constexpr int test6 = f(e3, 1);
932 constexpr int test7 = f(e1, 2);
933constexpr int test8 = f(e2, 2); // expected-error {{constant expression}} expected-note {{in call}}
934 constexpr int test9 = f(e3, 2);
935 constexpr int testa = f(e1, 3);
936constexpr int testb = f(e2, 3); // expected-error {{constant expression}} expected-note {{in call}}
937 constexpr int testc = f(e3, 3);
942 constexpr int f() { in f()
954 constexpr int f(int n) { in f()