| 1 |
// { dg-do run } |
| 2 |
// Testcase for tricky synthesized op= in complex inheritance situation. |
| 3 |
// This used to test whether the virtual base was copy-assigned only once. |
| 4 |
// That feature is not required by ISO C++, so the test now only checks |
| 5 |
// whether the vbase is assigned at all. |
| 6 |
|
| 7 |
int count = 0; |
| 8 |
extern "C" int printf (const char *, ...); |
| 9 |
|
| 10 |
class A { |
| 11 |
public: |
| 12 |
A& operator = (const A&) { count++; return *this; } |
| 13 |
}; |
| 14 |
|
| 15 |
class B: virtual private A { }; |
| 16 |
class C: virtual public A { }; |
| 17 |
class D: public B, public C { }; |
| 18 |
|
| 19 |
int main() |
| 20 |
{ |
| 21 |
D a, b; |
| 22 |
a = b; |
| 23 |
printf ("%d\n",count); |
| 24 |
if (count == 0) |
| 25 |
return 1; |
| 26 |
return 0; |
| 27 |
} |