blob: 71d2df858600d5e119ed17a2b2bdaade1be4ea31 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
/* [expr.eq] If both refer to (possibly different) members of the same union
(12.3), they compare equal. */
// { dg-do run { target c++11 } }
// { dg-additional-options -O }
union U
{
int i;
int j;
};
#define SA(X) static_assert ((X),#X)
SA (&U::i == &U::j);
SA (!(&U::i != &U::j));
#define assert(X) do { if (!(X)) __builtin_abort(); } while(0)
void f (int U::*p, int U::*q)
{
assert (p==q);
assert (!(p!=q));
}
int main()
{
assert (&U::i == &U::j);
assert (!(&U::i != &U::j));
}
|