summaryrefslogtreecommitdiffstats
path: root/test/CXX/expr/expr.const/p2-0x.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/CXX/expr/expr.const/p2-0x.cpp')
-rw-r--r--test/CXX/expr/expr.const/p2-0x.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/CXX/expr/expr.const/p2-0x.cpp b/test/CXX/expr/expr.const/p2-0x.cpp
index 065a12b..634dee3 100644
--- a/test/CXX/expr/expr.const/p2-0x.cpp
+++ b/test/CXX/expr/expr.const/p2-0x.cpp
@@ -118,7 +118,7 @@ namespace IncompleteClassTypeAddr {
constexpr S (*p2)[] = &sArr; // ok
struct S {
- constexpr S *operator&() { return nullptr; }
+ constexpr S *operator&() const { return nullptr; }
};
constexpr S *q = &s; // ok
static_assert(!q, "");
@@ -205,7 +205,7 @@ namespace UndefinedBehavior {
constexpr const int &np = (*(int(*)[4])nullptr)[2]; // expected-error {{constant expression}} expected-note {{cannot access array element of null pointer}}
struct C {
- constexpr int f() { return 0; }
+ constexpr int f() const { return 0; }
} constexpr c = C();
constexpr int k1 = c.f(); // ok
constexpr int k2 = ((C*)nullptr)->f(); // expected-error {{constant expression}} expected-note {{cannot call member function on null pointer}}
@@ -481,14 +481,14 @@ namespace UnspecifiedRelations {
public:
constexpr A() : a(0), b(0) {}
int a;
- constexpr bool cmp() { return &a < &b; } // expected-error {{constexpr function never produces a constant expression}} expected-note {{comparison of address of fields 'a' and 'b' of 'A' with differing access specifiers (public vs private) has unspecified value}}
+ constexpr bool cmp() const { return &a < &b; } // expected-error {{constexpr function never produces a constant expression}} expected-note {{comparison of address of fields 'a' and 'b' of 'A' with differing access specifiers (public vs private) has unspecified value}}
private:
int b;
};
class B {
public:
A a;
- constexpr bool cmp() { return &a.a < &b.a; } // expected-error {{constexpr function never produces a constant expression}} expected-note {{comparison of address of fields 'a' and 'b' of 'B' with differing access specifiers (public vs protected) has unspecified value}}
+ constexpr bool cmp() const { return &a.a < &b.a; } // expected-error {{constexpr function never produces a constant expression}} expected-note {{comparison of address of fields 'a' and 'b' of 'B' with differing access specifiers (public vs protected) has unspecified value}}
protected:
A b;
};
OpenPOWER on IntegriCloud