| 1 |
/* { dg-do run } */ |
| 2 |
|
| 3 |
extern void _exit(int); |
| 4 |
extern int strcmp(const char *, const char *); |
| 5 |
|
| 6 |
typedef struct Vec { |
| 7 |
double xv[10], yv[5]; |
| 8 |
float fscal; |
| 9 |
int z; |
| 10 |
} xyz_t ; |
| 11 |
|
| 12 |
typedef struct { |
| 13 |
float fscalar; |
| 14 |
double dscalar; |
| 15 |
xyz_t dv; |
| 16 |
int iscalar; |
| 17 |
long ln; |
| 18 |
long long lln; |
| 19 |
} anonymous; |
| 20 |
|
| 21 |
const char *enc = @encode(xyz_t); |
| 22 |
const char *enc2 = @encode(anonymous); |
| 23 |
|
| 24 |
#ifdef __LP64__ |
| 25 |
#define L "q" |
| 26 |
#else |
| 27 |
#define L "l" |
| 28 |
#endif |
| 29 |
|
| 30 |
int main(void) { |
| 31 |
const char *encode = @encode(long); |
| 32 |
|
| 33 |
if (strcmp (encode, L)) |
| 34 |
_exit(-(__LINE__)); |
| 35 |
|
| 36 |
if (strcmp (enc, "{Vec=[10d][5d]fi}")) |
| 37 |
_exit(-(__LINE__)); |
| 38 |
|
| 39 |
if (strcmp (enc2, "{?=fd{Vec=[10d][5d]fi}i" L "q}")) |
| 40 |
_exit(-(__LINE__)); |
| 41 |
|
| 42 |
return 0; |
| 43 |
} |