| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-O3 --param ipa-cp-eval-threshold=1" } */ |
| 3 |
|
| 4 |
extern "C" void abort (void); |
| 5 |
|
| 6 |
struct CBase { |
| 7 |
virtual void BaseFunc () {} |
| 8 |
}; |
| 9 |
|
| 10 |
struct MMixin { |
| 11 |
virtual void * MixinFunc (int, void *) = 0; |
| 12 |
}; |
| 13 |
|
| 14 |
struct CExample: CBase, public MMixin |
| 15 |
{ |
| 16 |
int stuff, magic, more_stuff; |
| 17 |
|
| 18 |
CExample () |
| 19 |
{ |
| 20 |
stuff = 0; |
| 21 |
magic = 0xbeef; |
| 22 |
more_stuff = 0; |
| 23 |
} |
| 24 |
void *MixinFunc (int arg, void *arg2) |
| 25 |
{ |
| 26 |
if (arg != 1 || arg2) |
| 27 |
return 0; |
| 28 |
if (magic != 0xbeef) |
| 29 |
abort(); |
| 30 |
return this; |
| 31 |
} |
| 32 |
}; |
| 33 |
|
| 34 |
void *test (MMixin & anExample) |
| 35 |
{ |
| 36 |
return anExample.MixinFunc (1, 0); |
| 37 |
} |
| 38 |
|
| 39 |
int main () |
| 40 |
{ |
| 41 |
CExample c; |
| 42 |
test (c); |
| 43 |
return 0; |
| 44 |
} |