reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    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
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
struct A {
  explicit A(int u) { _u._u3 = u; }
  A(const A &) = default;
  virtual ~A() = default;

private:
  union U {
    char _u1;
    short _u2;
    int _u3;
  };

  A::U _u;
};

#pragma pack(push, 1)
template <int I> struct B : public virtual A {
  B(char a, unsigned short b, int c) : A(a + b + c), _a(a), _b(b), _c(c) {}

private:
  char _a;
  unsigned short : 3;
  unsigned short _b : 6;
  unsigned short : 4;
  int _c;
};
#pragma pack(pop)

#pragma pack(push, 16)
class C : private virtual B<0>, public virtual B<1>, private B<2>, public B<3> {
public:
  C(char x, char y, char z)
      : A(x - y + z), B<0>(x, y, z), B<1>(x * 2, y * 2, z * 2),
        B<2>(x * 3, y * 3, z * 3), B<3>(x * 4, y * 4, z * 4), _x(x * 5),
        _y(y * 5), _z(z * 5) {}

  static int abc;

private:
  int _x;
  short _y;
  char _z;
};
int C::abc = 123;
#pragma pack(pop)

class List {
public:
  List() = default;
  List(List *p, List *n, C v) : Prev(p), Next(n), Value(v) {}

private:
  List *Prev = nullptr;
  List *Next = nullptr;
  C Value{1, 2, 3};
};

int main() {
  List ls[16];
  return 0;
}