| 1 |
/* DR 1511 - const volatile variables and the one-definition rule */ |
| 2 |
/* { dg-do run } */ |
| 3 |
/* { dg-additional-sources "dr1511-2.C" } */ |
| 4 |
|
| 5 |
typedef const int cint; |
| 6 |
typedef const volatile int cvint; |
| 7 |
typedef volatile int vint; |
| 8 |
const int v1 = 5; |
| 9 |
extern volatile const int v2; |
| 10 |
cint v3 = 7; |
| 11 |
extern cvint v4; |
| 12 |
extern const vint v5; |
| 13 |
extern volatile cint v6; |
| 14 |
const int w1 = 5; |
| 15 |
extern volatile const int w2; |
| 16 |
cint w3 = 7; |
| 17 |
extern cvint w4; |
| 18 |
extern const vint w5; |
| 19 |
extern volatile cint w6; |
| 20 |
extern const int &r1; |
| 21 |
extern volatile const int &r2; |
| 22 |
extern const int &r3; |
| 23 |
extern const volatile int &r4; |
| 24 |
extern const volatile int &r5; |
| 25 |
extern const volatile int &r6; |
| 26 |
|
| 27 |
int |
| 28 |
main () |
| 29 |
{ |
| 30 |
if (v1 != 5 || v2 != 6 || v3 != 7 || v4 != 8 || v5 != 9 || v6 != 10) |
| 31 |
__builtin_abort (); |
| 32 |
if (w1 != 5 || w2 != 6 || w3 != 7 || w4 != 8 || w5 != 9 || w6 != 10) |
| 33 |
__builtin_abort (); |
| 34 |
if (r1 != w1 || &r1 == &w1 || r2 != w2 || &r2 != &w2 || r3 != w3 || &r3 == &w3) |
| 35 |
__builtin_abort (); |
| 36 |
if (r4 != w4 || &r4 != &w4 || r5 != w5 || &r5 != &w5 || r6 != w6 || &r6 != &w6) |
| 37 |
__builtin_abort (); |
| 38 |
} |