summary refs log tree commit diff
path: root/src/test/ui/const-generics/const-expression-parameter.rs
blob: f4e9008dbd0f1563f7d8e4c211fd317d5624d112 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash

fn u32_identity<const X: u32>() -> u32 {
    //~^ ERROR const generics in any position are currently unsupported
    5
}

fn foo_a() {
    u32_identity::<-1>(); //~ ERROR expected identifier, found `<-`
}

fn foo_b() {
    u32_identity::<1 + 2>(); //~ ERROR expected one of `,` or `>`, found `+`
}

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

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