| 1 |
// { dg-do run } |
| 2 |
// GROUPS passed code-generation |
| 3 |
// Check that sub-word sized structs/classes are passed correctly |
| 4 |
// if the struct/class has a constructor (i.e. ANY constructor). |
| 5 |
|
| 6 |
extern "C" int printf (const char *, ...); |
| 7 |
|
| 8 |
struct base { |
| 9 |
unsigned int f1 : 8; |
| 10 |
unsigned int f2 : 8; |
| 11 |
|
| 12 |
base (int ii) |
| 13 |
{ |
| 14 |
} |
| 15 |
}; |
| 16 |
|
| 17 |
base global_base (7); |
| 18 |
|
| 19 |
int test2 (base formal_base); |
| 20 |
|
| 21 |
int main () |
| 22 |
{ |
| 23 |
global_base.f1 = 0x55; |
| 24 |
global_base.f2 = 0xee; |
| 25 |
|
| 26 |
if (test2 (global_base) == 0) |
| 27 |
printf ("PASS\n"); |
| 28 |
else |
| 29 |
{ printf ("FAIL\n"); return 1; } |
| 30 |
|
| 31 |
return 0; |
| 32 |
} |
| 33 |
|
| 34 |
int test2 (base formal_base) |
| 35 |
{ |
| 36 |
if (formal_base.f1 != global_base.f1) |
| 37 |
return -1; |
| 38 |
if (formal_base.f2 != global_base.f2) |
| 39 |
return -1; |
| 40 |
return 0; |
| 41 |
} |