Home | History | Annotate | Download | only in SemaCXX

Lines Matching full:constant

69 static_assert(j(2), ""); // expected-error {{constant expression}} expected-note {{in call to 'j(2)'}}
78 // If the return type is not 'void', no return statements => never a constant
91 constexpr U u2{2}; // expected-error {{constant expression}} expected-note {{in call to 'U(2)'}}
100 static_assert(l(true), ""); // expected-error {{constant expression}} expected-note {{in call to 'l(true)'}}
102 // Potential constant expression checking is still applied where possible.
103 constexpr int htonl(int x) { // expected-error {{never produces a constant expression}}
106 return *reinterpret_cast<int*>(arr); // expected-note {{reinterpret_cast is not allowed in a constant expression}}
115 return *reinterpret_cast<int*>(arr); // expected-note {{reinterpret_cast is not allowed in a constant expression}}
118 constexpr int swapped = maybe_htonl(false, 123); // expected-error {{constant expression}} expected-note {{in call}}
134 const_cast<int&>(a) = b; // expected-note 2{{constant expression cannot modify an object that is visible outside that expression}}
141 static_assert((set(a, 1), a) == 1, ""); // expected-error {{constant expression}} expected-note {{in call to 'set(a, 1)'}}
142 static_assert((set(b, 1), b) == 1, ""); // expected-error {{constant expression}} expected-note {{in call to 'set(b, 1)'}}
143 static_assert((set(c, 1), c) == 1, ""); // expected-error {{constant expression}} expected-note {{read of non-const variable 'c'}}
147 static_assert(wrap(c, 1) == 1, ""); // expected-error {{constant expression}} expected-note {{read of non-const variable 'c'}}
180 static_assert(!test1(101), ""); // expected-error {{constant expression}} expected-note {{in call to 'test1(101)'}}
187 constexpr int k = (f(), 0); // expected-error {{constant expression}} expected-note {{in call}}
200 static_assert(do_stuff(1234, 0) == 1, ""); // expected-error {{constant expression}} expected-note {{in call}}
201 static_assert(do_stuff(1235, 0) == 1, ""); // expected-error {{constant expression}} expected-note {{in call}}
202 static_assert(do_stuff(-1, 0) == 1, ""); // expected-error {{constant expression}} expected-note {{in call}}
208 constexpr int div_zero_2() { // expected-error {{never produces a constant expression}}
213 constexpr int ref() { // expected-error {{never produces a constant expression}}
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}}
257 static_assert(test2() == 1, ""); // expected-error {{constant expression}} expected-note {{in call}}
258 constexpr int i = test2(); // expected-error {{constant expression}} expected-note {{in call}}
265 static_assert(test(0), ""); // expected-error {{constant expression}} expected-note {{in call}}
280 constexpr int overflow_int_inc_1 = ref(0x7fffffff)++; // expected-error {{constant}} expected-note {{2147483648}}
282 constexpr int overflow_int_inc_2 = ++ref(0x7fffffff); // expected-error {{constant}} expected-note {{2147483648}}
296 static_assert(++ref(&arr[10]) == &arr[11], ""); // expected-error {{constant}} expected-note {{cannot refer to element 11}}
298 static_assert(ref(&arr[10])++ == &arr[10], ""); // expected-error {{constant}} expected-note {{cannot refer to element 11}}
302 static_assert(--ref(&arr[0]) != &arr[0], ""); // expected-error {{constant}} expected-note {{cannot refer to element -1}}
304 static_assert(ref(&arr[0])-- == &arr[0], ""); // expected-error {{constant}} expected-note {{cannot refer to element -1}}
326 constexpr int wrong_member = f({0}); // expected-error {{constant}} expected-note {{in call to 'f({.a = 0})'}}
327 constexpr int vol = --ref<volatile int>(0); // expected-error {{constant}} expected-note {{decrement of volatile-qualified}}
402 static_assert(test_overflow<int>(), ""); // expected-error {{constant}} expected-note {{call}}
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}}
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 {{call}}
428 static_assert(test_bounds("foo", 1000) != 0, ""); // expected-error {{constant}} expected-note {{call}}
726 constexpr int k = a.temporary++; // expected-error {{constant expression}} expected-note {{outside the expression that created the temporary}}
781 static_assert(f(1) == 1, ""); // expected-error {{constant expression}} expected-note {{in call}}
783 constexpr int g() { // expected-error {{never produces a constant}}
788 constexpr int h() { // expected-error {{never produces a constant}}
815 static_assert(q->f() == sizeof(X<S2>), ""); // expected-error {{constant expression}} expected-note {{virtual function call}}
824 static_assert(f() == 123, ""); // expected-error {{constant expression}} expected-note {{in call}}
836 static_assert(g() == 42, ""); // expected-error {{constant expression}} expected-note {{in call}}
854 static_assert(h(1) == 0, ""); // expected-error {{constant expression}} expected-note {{in call}}
855 static_assert(h(2) == 0, ""); // expected-error {{constant expression}} expected-note {{in call}}
856 static_assert(h(3) == 0, ""); // expected-error {{constant expression}} expected-note {{in call}}
858 // FIXME: This function should be treated as non-constant.