aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/spaceship-eq11.C
blob: b71ed4f83179cd70b276d2aace344c68aca78157 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// PR c++/102490
// { dg-do run { target c++20 } }

struct A
{
  unsigned char a : 1;
  unsigned char b : 1;
  constexpr bool operator== (const A &) const = default;
};

struct B
{
  unsigned char a : 8;
  int : 0;
  unsigned char b : 7;
  constexpr bool operator== (const B &) const = default;
};

struct C
{
  unsigned char a : 3;
  unsigned char b : 1;
  constexpr bool operator== (const C &) const = default;
};

void
foo (C &x, int y)
{
  x.b = y;
}

int
main ()
{
  A a{}, b{};
  B c{}, d{};
  C e{}, f{};
  a.b = 1;
  d.b = 1;
  foo (e, 0);
  foo (f, 1);
  return a == b || c == d || e == f;
}