aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/cfg1.rs
blob: 6984f04d1b921f65494c5e538cc1237a7e420b0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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 }
}