aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/init/assign1.C
blob: 690a481910a39c2c9d6fa232697ad3ee5eec2339 (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
// PR c++/13009
// { dg-do run }

struct A {
  char a;
};

struct B: public virtual A {
  #if 0 // this piece of code works around the problem
  B& operator= (const B& other)
  {
    A::operator= (other);
  }
  #endif
};

struct C: public B {
  char c;
};

int main() {
  B b;
  b.a = 'b';
  C c;
  c.a = c.c = 'c';
  
  c.B::operator= (b);
  if (c.a != 'b' || c.c != 'c')
    return 1;
}