summaryrefslogtreecommitdiffstats
path: root/tests/ui/const-generics/early/const-expression-parameter.rs
blob: 4cf7ba86921cec7b14eb675e86cdc07a052e2aa5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
fn i32_identity<const X: i32>() -> i32 {
    5
}

fn foo_a() {
    i32_identity::<-1>(); // ok
}

fn foo_b() {
    i32_identity::<1 + 2>(); //~ ERROR expressions must be enclosed in braces
}

fn foo_c() {
    i32_identity::< -1 >(); // ok
}

fn main() {
    i32_identity::<5>(); // ok
}