2019-02-20 11:01:39 +00:00
|
|
|
fn i32_identity<const X: i32>() -> i32 {
|
2019-02-07 10:10:11 +01:00
|
|
|
5
|
|
|
|
}
|
|
|
|
|
|
|
|
fn foo_a() {
|
2019-05-06 17:00:01 +01:00
|
|
|
i32_identity::<-1>(); // ok
|
2019-02-07 10:10:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
fn foo_b() {
|
2020-10-03 19:30:32 +01:00
|
|
|
i32_identity::<1 + 2>(); //~ ERROR expressions must be enclosed in braces
|
2019-02-07 10:10:11 +01:00
|
|
|
}
|
|
|
|
|
2019-02-07 14:58:47 +01:00
|
|
|
fn foo_c() {
|
2019-02-20 11:01:39 +00:00
|
|
|
i32_identity::< -1 >(); // ok
|
2019-02-07 14:58:47 +01:00
|
|
|
}
|
|
|
|
|
2019-02-07 10:10:11 +01:00
|
|
|
fn main() {
|
2019-02-20 11:01:39 +00:00
|
|
|
i32_identity::<5>(); // ok
|
2019-02-07 10:10:11 +01:00
|
|
|
}
|