| 1 |
/* Verify that the "aka" descriptions for typedefs are correctly |
| 2 |
quoted (PR 62170). */ |
| 3 |
|
| 4 |
/* Exercise %H and %I. */ |
| 5 |
|
| 6 |
typedef struct s1 t1; |
| 7 |
typedef struct s2 {int i;} t2; |
| 8 |
|
| 9 |
int foo(t1 *); |
| 10 |
|
| 11 |
void test_1 () { |
| 12 |
t2 pos; |
| 13 |
|
| 14 |
foo (&pos); // { dg-error "cannot convert 't2\\*' {aka 's2\\*'} to 't1\\*' {aka 's1\\*'}" } |
| 15 |
} |
| 16 |
|
| 17 |
/* Exercise %T. */ |
| 18 |
|
| 19 |
typedef struct s3 |
| 20 |
{ |
| 21 |
void m3 (); |
| 22 |
} t3; |
| 23 |
|
| 24 |
void test_2 (const s3 *ptr) |
| 25 |
{ |
| 26 |
ptr->m3 (); // { dg-error "passing 'const s3' as 'this' argument discards qualifiers" } |
| 27 |
} |
| 28 |
|
| 29 |
void test_3 (const t3 *ptr) |
| 30 |
{ |
| 31 |
ptr->m3 (); // { dg-error "passing 'const t3' {aka 'const s3'} as 'this' argument discards qualifiers" } |
| 32 |
} |