| 1 |
fn main() |
| 2 |
{ |
| 3 |
// tuples |
| 4 |
let z = (); |
| 5 |
|
| 6 |
let o = (0,); |
| 7 |
/* Binary, Octal and Hex literals are invalid. */ |
| 8 |
let _fb = o.0b0; // { dg-error "tuple index should be a pure decimal literal" } |
| 9 |
let _fo = o.0o0; // { dg-error "tuple index should be a pure decimal literal" } |
| 10 |
let _fh = o.0x0; // { dg-error "tuple index should be a pure decimal literal" } |
| 11 |
|
| 12 |
/* No underscores. */ |
| 13 |
let _fua = o.0_; // { dg-error "tuple index should be a pure decimal literal" } |
| 14 |
|
| 15 |
/* Suffix is not allowed. */ |
| 16 |
let _fu8 = o.0u8; // { dg-error "tuple index should be a pure decimal literal" } |
| 17 |
let _fi8 = o.0i8; // { dg-error "tuple index should be a pure decimal literal" } |
| 18 |
let _fu16 = o.0u16; // { dg-error "tuple index should be a pure decimal literal" } |
| 19 |
let _fi16 = o.0i16; // { dg-error "tuple index should be a pure decimal literal" } |
| 20 |
let _fu32 = o.0u32; // { dg-error "tuple index should be a pure decimal literal" } |
| 21 |
let _fi32 = o.0i32; // { dg-error "tuple index should be a pure decimal literal" } |
| 22 |
let _fu64 = o.0u64; // { dg-error "tuple index should be a pure decimal literal" } |
| 23 |
let _fi64 = o.0i64; // { dg-error "tuple index should be a pure decimal literal" } |
| 24 |
let _fu128 = o.0u128; // { dg-error "tuple index should be a pure decimal literal" } |
| 25 |
let _fi128 = o.0i128; // { dg-error "tuple index should be a pure decimal literal" } |
| 26 |
let _fusize = o.0usize; // { dg-error "tuple index should be a pure decimal literal" } |
| 27 |
let _fisize = o.0isize; // { dg-error "tuple index should be a pure decimal literal" } |
| 28 |
|
| 29 |
let t = (0,1); |
| 30 |
/* No extra zero prefix. */ |
| 31 |
let _s = t.01; // { dg-error "tuple index should be a pure decimal literal" } |
| 32 |
|
| 33 |
let m = (0,1,2,3,4,5,6,7,8,9,10); |
| 34 |
/* No extra zero prefix. */ |
| 35 |
let _l = m.010; // { dg-error "tuple index should be a pure decimal literal" } |
| 36 |
|
| 37 |
/* No underscores. */ |
| 38 |
let _lu = m.1_0; // { dg-error "tuple index should be a pure decimal literal" } |
| 39 |
|
| 40 |
// tuple structs |
| 41 |
struct E(); |
| 42 |
let _e = E(); |
| 43 |
|
| 44 |
struct O(i32); |
| 45 |
let so = O(0); |
| 46 |
/* No leading zeros, no underscores. */ |
| 47 |
let _sf = so.0_0; // { dg-error "tuple index should be a pure decimal literal" } |
| 48 |
/* Binary, Octal and Hex literals are invalid. */ |
| 49 |
let _sb = so.0b0; // { dg-error "tuple index should be a pure decimal literal" } |
| 50 |
let _so = so.0o0; // { dg-error "tuple index should be a pure decimal literal" } |
| 51 |
let _sh = so.0x0; // { dg-error "tuple index should be a pure decimal literal" } |
| 52 |
|
| 53 |
struct T(i32,i32); |
| 54 |
let st = T(0,1); |
| 55 |
/* Suffix is not allowed. */ |
| 56 |
let _stfu32 = st.1u32; // { dg-error "tuple index should be a pure decimal literal" } |
| 57 |
let _stfi32 = st.1i32; // { dg-error "tuple index should be a pure decimal literal" } |
| 58 |
|
| 59 |
struct M(i32,i32,i32,i32,i32,i32,i32,i32,i32,i32,i32); |
| 60 |
let sm = M(0,1,2,3,4,5,6,7,8,9,10); |
| 61 |
/* No underscores. */ |
| 62 |
let _sl2 = sm.1_0; // { dg-error "tuple index should be a pure decimal literal" } |
| 63 |
let _sl3 = sm.10_; // { dg-error "tuple index should be a pure decimal literal" } |
| 64 |
|
| 65 |
z |
| 66 |
} |