diff options
Diffstat (limited to 'gcc/testsuite/rust/compile/cfg1.rs')
-rw-r--r-- | gcc/testsuite/rust/compile/cfg1.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc/testsuite/rust/compile/cfg1.rs b/gcc/testsuite/rust/compile/cfg1.rs new file mode 100644 index 0000000..6984f04 --- /dev/null +++ b/gcc/testsuite/rust/compile/cfg1.rs @@ -0,0 +1,31 @@ +// { dg-additional-options "-w" } +extern "C" { + fn printf(s: *const i8, ...); +} + +#[cfg(A)] +fn test() { + unsafe { + let a = "test1\n\0"; + let b = a as *const str; + let c = b as *const i8; + + printf(c); + } +} + +#[cfg(B)] +fn test() { + unsafe { + let a = "test2\n\0"; + let b = a as *const str; + let c = b as *const i8; + + printf(c); + } +} + +fn main() { + test(); + // { dg-error "Cannot find path .test. in this scope" "" { target *-*-* } .-1 } +} |