diff options
Diffstat (limited to 'gcc/testsuite/rust/compile/dup_fields.rs')
-rw-r--r-- | gcc/testsuite/rust/compile/dup_fields.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/rust/compile/dup_fields.rs b/gcc/testsuite/rust/compile/dup_fields.rs new file mode 100644 index 0000000..ab39955 --- /dev/null +++ b/gcc/testsuite/rust/compile/dup_fields.rs @@ -0,0 +1,23 @@ +struct S { a: i32, b: i32, c: u8, a: i128 } +// { dg-error "duplicate field" "" { target *-*-* } .-1 } + +union U + { + a: i32, + b: i32, + c: u8, + b: char // { dg-error "duplicate field" "" { target *-*-* } } + } + +fn main () +{ + struct SS { alpha: i32, beta: i32, gamma: u8, gamma: i128 } + // { dg-error "duplicate field" "" { target *-*-* } .-1 } + + union UU + { + alpha: i32, beta: i32, + gamma: u8, beta: char + // { dg-error "duplicate field" "" { target *-*-* } .-1 } + } +} |