111
|
1 // { dg-do compile { target c++11 } }
|
|
2
|
|
3 struct C { // literal type
|
|
4 int m;
|
|
5 int n;
|
|
6 constexpr C(int m) : m(m), n(-m) {}
|
|
7 constexpr bool is_neg() const { return m < 0; }
|
|
8 };
|
|
9
|
|
10 constexpr bool check1(const C& c, int C:: *pm) { return c.*pm < 0; } // #1
|
|
11
|
|
12 constexpr bool check2(const C* pc, bool (C::*pm)() const) { return
|
|
13 (pc->*pm)(); } // #2
|
|
14
|
|
15 constexpr C c(-1);
|
|
16
|
|
17 static_assert(!check1(c, &C::n), "Error");
|
|
18 static_assert(check1(c, &C::m), "Error");
|
|
19
|
|
20 static_assert(check2(&c, &C::is_neg), "Error");
|