2020-08-09 06:19:57 +00:00
|
|
|
// revisions: full min
|
|
|
|
|
|
|
|
#![cfg_attr(full, feature(const_generics))]
|
|
|
|
#![cfg_attr(full, allow(incomplete_features))]
|
|
|
|
#![cfg_attr(min, feature(min_const_generics))]
|
2019-02-07 09:10:11 +00:00
|
|
|
|
2019-02-20 11:01:39 +00:00
|
|
|
fn i32_identity<const X: i32>() -> i32 {
|
2019-02-07 09:10:11 +00:00
|
|
|
5
|
|
|
|
}
|
|
|
|
|
|
|
|
fn foo_a() {
|
2019-05-06 16:00:01 +00:00
|
|
|
i32_identity::<-1>(); // ok
|
2019-02-07 09:10:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn foo_b() {
|
2019-02-20 11:01:39 +00:00
|
|
|
i32_identity::<1 + 2>(); //~ ERROR expected one of `,` or `>`, found `+`
|
2019-02-07 09:10:11 +00:00
|
|
|
}
|
|
|
|
|
2019-02-07 13:58:47 +00:00
|
|
|
fn foo_c() {
|
2019-02-20 11:01:39 +00:00
|
|
|
i32_identity::< -1 >(); // ok
|
2019-02-07 13:58:47 +00:00
|
|
|
}
|
|
|
|
|
2019-02-07 09:10:11 +00:00
|
|
|
fn main() {
|
2019-02-20 11:01:39 +00:00
|
|
|
i32_identity::<5>(); // ok
|
2019-02-07 09:10:11 +00:00
|
|
|
}
|