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