constant-expression-cxx11.cpp revision 9e36b533af1b2fa9f32c4372c4081abdd86f47e0
1f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// RUN: %clang_cc1 -triple i686-linux -fsyntax-only -verify -std=c++11 %s 2f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 3f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// FIXME: support const T& parameters here. 4f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org//template<typename T> constexpr T id(const T &t) { return t; } 5f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgtemplate<typename T> constexpr T id(T t) { return t; } 6f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// FIXME: support templates here. 7f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org//template<typename T> constexpr T min(const T &a, const T &b) { 8f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// return a < b ? a : b; 9f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org//} 10f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org//template<typename T> constexpr T max(const T &a, const T &b) { 11f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org// return a < b ? b : a; 12f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org//} 13f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgconstexpr int min(const int &a, const int &b) { return a < b ? a : b; } 14f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgconstexpr int max(const int &a, const int &b) { return a < b ? b : a; } 15f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 16f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct MemberZero { 17f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org constexpr int zero() { return 0; } 18f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}; 19f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 20f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgnamespace TemplateArgumentConversion { 21f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org template<int n> struct IntParam {}; 22f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 23f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org using IntParam0 = IntParam<0>; 24f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org // FIXME: This should be accepted once we do constexpr function invocation. 25f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org using IntParam0 = IntParam<id(0)>; // expected-error {{not an integral constant expression}} 26f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org using IntParam0 = IntParam<MemberZero().zero>; // expected-error {{did you mean to call it with no arguments?}} expected-error {{not an integral constant expression}} 27f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 28f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 29f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgnamespace CaseStatements { 30f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org void f(int n) { 31f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org switch (n) { 32f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org // FIXME: Produce the 'add ()' fixit for this. 33f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org case MemberZero().zero: // desired-error {{did you mean to call it with no arguments?}} expected-error {{not an integer constant expression}} 34f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org // FIXME: This should be accepted once we do constexpr function invocation. 35f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org case id(1): // expected-error {{not an integer constant expression}} 36f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org return; 37f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org } 38f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org } 39f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 40f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 41f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgextern int &Recurse1; 42f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgint &Recurse2 = Recurse1, &Recurse1 = Recurse2; 43f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgconstexpr int &Recurse3 = Recurse2; // expected-error {{must be initialized by a constant expression}} 44f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 45f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgnamespace MemberEnum { 46f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct WithMemberEnum { 47f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org enum E { A = 42 }; 48f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org } wme; 49f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org // FIXME: b's initializer is not treated as a constant expression yet, but we 50f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org // can at least fold it. 51f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org constexpr bool b = wme.A == 42; 52f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org int n[b]; 53f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 54f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 55f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgnamespace Recursion { 56f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org constexpr int fib(int n) { return n > 1 ? fib(n-1) + fib(n-2) : n; } 57f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org // FIXME: this isn't an ICE yet. 58f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org using check_fib = int[fib(11)]; 59f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org using check_fib = int[89]; 60f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 61f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org constexpr int gcd_inner(int a, int b) { 62f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org return b == 0 ? a : gcd_inner(b, a % b); 63f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org } 64f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org constexpr int gcd(int a, int b) { 65f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org return gcd_inner(max(a, b), min(a, b)); 66f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org } 67f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 68f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org // FIXME: this isn't an ICE yet. 69f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org using check_gcd = int[gcd(1749237, 5628959)]; 70f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org using check_gcd = int[7]; 71f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 72f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 73f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgnamespace FunctionCast { 74f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org // When folding, we allow functions to be cast to different types. Such 75f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org // cast functions cannot be called, even if they're constexpr. 76f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org constexpr int f() { return 1; } 77f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org typedef double (*DoubleFn)(); 78f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org typedef int (*IntFn)(); 79f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org int a[(int)DoubleFn(f)()]; // expected-error {{variable length array}} 80f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org int b[(int)IntFn(f)()]; // ok 81f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 82f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 83f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgnamespace StaticMemberFunction { 84f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct S { 85f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org static constexpr int k = 42; 86f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org static constexpr int f(int n) { return n * k + 2; } 87f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org } s; 88f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org // FIXME: this isn't an ICE yet. 89f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org using check_static_call = int[S::f(19)]; 90f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org constexpr int n = s.f(19); 91f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org using check_static_call = int[s.f(19)]; 92f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org using check_static_call = int[800]; 93f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 94f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 95f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgnamespace ParameterScopes { 96f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 97f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org const int k = 42; 98f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org constexpr const int &ObscureTheTruth(const int &a) { return a; } 99f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org constexpr const int &MaybeReturnJunk(bool b, const int a) { 100f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org return ObscureTheTruth(b ? a : k); 101f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org } 102f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org constexpr int n1 = MaybeReturnJunk(false, 0); // ok 103f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org constexpr int n2 = MaybeReturnJunk(true, 0); // expected-error {{must be initialized by a constant expression}} 104f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 105f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org constexpr int InternalReturnJunk(int n) { 106f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org // FIXME: We should reject this: it never produces a constant expression. 107f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org return MaybeReturnJunk(true, n); 108f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org } 109f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org constexpr int n3 = InternalReturnJunk(0); // expected-error {{must be initialized by a constant expression}} 110f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 111f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org constexpr int LToR(int &n) { return n; } 112f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org constexpr int GrabCallersArgument(bool which, int a, int b) { 113f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org return LToR(which ? b : a); 114f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org } 115f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org constexpr int n4 = GrabCallersArgument(false, 1, 2); 116f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org constexpr int n5 = GrabCallersArgument(true, 4, 8); 117f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org // FIXME: this isn't an ICE yet. 118f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org using check_value = int[n4 + n5]; 119f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org using check_value = int[9]; 120f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 121f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 122f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 123f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgnamespace Pointers { 124f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 125f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org constexpr int f(int n, const int *a, const int *b, const int *c) { 126f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org return n == 0 ? 0 : *a + f(n-1, b, c, a); 127f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org } 128f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 129f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org const int x = 1, y = 10, z = 100; 130f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org constexpr int n1 = f(23, &x, &y, &z); 131f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org // FIXME: this isn't an ICE yet. 132f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org using check_value_1 = int[n1]; 133f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org using check_value_1 = int[788]; 134f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 135f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org constexpr int g(int n, int a, int b, int c) { 136f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org return f(n, &a, &b, &c); 137f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org } 138f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org constexpr int n2 = g(23, x, y, z); 139f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org using check_value_1 = int[n2]; 140f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 141f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 142f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 143f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgnamespace FunctionPointers { 144f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 145f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org constexpr int Double(int n) { return 2 * n; } 146f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org constexpr int Triple(int n) { return 3 * n; } 147f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org constexpr int Twice(int (*F)(int), int n) { return F(F(n)); } 148f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org constexpr int Quadruple(int n) { return Twice(Double, n); } 149f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org constexpr auto Select(int n) -> int (*)(int) { 150f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org return n == 2 ? &Double : n == 3 ? &Triple : n == 4 ? &Quadruple : 0; 151f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org } 152f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org constexpr int Apply(int (*F)(int), int n) { return F(n); } 153f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 154f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org using check_value = int[1 + Apply(Select(4), 5) + Apply(Select(3), 7)]; 155f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org using check_value = int[42]; 156f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 157f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org constexpr int Invalid = Apply(Select(0), 0); // expected-error {{must be initialized by a constant expression}} 158f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 159f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 160f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 161f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgnamespace PointerComparison { 162f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 163f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgint x, y; 164f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgconstexpr bool g1 = &x == &y; 165f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgconstexpr bool g2 = &x != &y; 166f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgconstexpr bool g3 = &x <= &y; // expected-error {{must be initialized by a constant expression}} 167f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgconstexpr bool g4 = &x >= &y; // expected-error {{must be initialized by a constant expression}} 168f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgconstexpr bool g5 = &x < &y; // expected-error {{must be initialized by a constant expression}} 169f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgconstexpr bool g6 = &x > &y; // expected-error {{must be initialized by a constant expression}} 170f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 171f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct S { int x, y; } s; 172f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgconstexpr bool m1 = &s.x == &s.y; 173f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgconstexpr bool m2 = &s.x != &s.y; 174f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgconstexpr bool m3 = &s.x <= &s.y; 175f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgconstexpr bool m4 = &s.x >= &s.y; 176f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgconstexpr bool m5 = &s.x < &s.y; 177f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgconstexpr bool m6 = &s.x > &s.y; 178f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 179f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgconstexpr bool n1 = 0 == &y; 180f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgconstexpr bool n2 = 0 != &y; 181f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgconstexpr bool n3 = 0 <= &y; // expected-error {{must be initialized by a constant expression}} 182f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgconstexpr bool n4 = 0 >= &y; // expected-error {{must be initialized by a constant expression}} 183f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgconstexpr bool n5 = 0 < &y; // expected-error {{must be initialized by a constant expression}} 184f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgconstexpr bool n6 = 0 > &y; // expected-error {{must be initialized by a constant expression}} 185f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 186f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgconstexpr bool n7 = &x == 0; 187f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgconstexpr bool n8 = &x != 0; 188f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgconstexpr bool n9 = &x <= 0; // expected-error {{must be initialized by a constant expression}} 189f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgconstexpr bool n10 = &x >= 0; // expected-error {{must be initialized by a constant expression}} 190f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgconstexpr bool n11 = &x < 0; // expected-error {{must be initialized by a constant expression}} 191f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgconstexpr bool n12 = &x > 0; // expected-error {{must be initialized by a constant expression}} 192f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 193f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgconstexpr bool s1 = &x == &x; 194f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgconstexpr bool s2 = &x != &x; 195f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgconstexpr bool s3 = &x <= &x; 196f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgconstexpr bool s4 = &x >= &x; 197f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgconstexpr bool s5 = &x < &x; 198f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgconstexpr bool s6 = &x > &x; 199f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 200f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgusing check = int[m1 + (m2<<1) + (m3<<2) + (m4<<3) + (m5<<4) + (m6<<5) + 201f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org (n1<<6) + (n2<<7) + (n7<<8) + (n8<<9) + (g1<<10) + (g2<<11) + 202f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org (s1<<12) + (s2<<13) + (s3<<14) + (s4<<15) + (s5<<16) + (s6<<17)]; 203f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgusing check = int[2+4+16+128+512+2048+4096+16384+32768]; 204f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 205f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org} 206f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org