aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/traits11.rs
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/rust/compile/traits11.rs')
-rw-r--r--gcc/testsuite/rust/compile/traits11.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/rust/compile/traits11.rs b/gcc/testsuite/rust/compile/traits11.rs
new file mode 100644
index 0000000..d06e47d
--- /dev/null
+++ b/gcc/testsuite/rust/compile/traits11.rs
@@ -0,0 +1,19 @@
+struct Foo(i32);
+
+trait A {
+ const A: i32 = 123;
+ fn B();
+ fn C(&self);
+}
+
+trait B: A {
+ fn test(&self);
+}
+
+pub fn main() {
+ let a;
+ a = Foo(123);
+
+ let b: &dyn B = &a;
+ // { dg-error "trait bound is not object safe" "" { target *-*-* } .-1 }
+}