aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/macro9.rs
blob: 9a59089b1e4fe20dabf311eb418c1fb25e8b3363 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
macro_rules! add {
    ($e:expr, $($es:expr),*) => {
        $e + add!($($es),*)
    };
    ($e:expr) => {
        $e
    };
}

fn main() -> i32 {
    let a = add!(15 2 9); // { dg-error "Failed to match any rule within macro" }
    let b = add!(15);
    let b = add!(15 14); // { dg-error "Failed to match any rule within macro" }
    let b = add!(15, 14,); // { dg-error "Failed to match any rule within macro" }

    0
}