aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/cfg2.rs
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/rust/compile/cfg2.rs')
-rw-r--r--gcc/testsuite/rust/compile/cfg2.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/testsuite/rust/compile/cfg2.rs b/gcc/testsuite/rust/compile/cfg2.rs
new file mode 100644
index 0000000..939384c
--- /dev/null
+++ b/gcc/testsuite/rust/compile/cfg2.rs
@@ -0,0 +1,13 @@
+// { dg-additional-options "-w -frust-cfg=A" }
+struct Foo;
+impl Foo {
+ #[cfg(not(A))]
+ fn test(&self) {}
+}
+
+fn main() {
+ let a = Foo;
+ a.test();
+ // { dg-error "failed to resolve method for .test." "" { target *-*-* } .-1 }
+ // { dg-error "failed to type resolve expression" "" { target *-*-* } .-2 }
+}