2020-08-09 01:19:57 -05:00
|
|
|
// revisions: full min
|
|
|
|
|
2021-08-30 03:59:53 -05:00
|
|
|
#![cfg_attr(full, feature(adt_const_params))]
|
2020-08-09 01:19:57 -05:00
|
|
|
#![cfg_attr(full, allow(incomplete_features))]
|
2019-09-30 23:55:26 -05:00
|
|
|
|
|
|
|
struct Checked<const F: fn(usize) -> bool>;
|
2020-06-12 12:25:14 -05:00
|
|
|
//~^ ERROR: using function pointers as const generic parameters
|
2019-09-30 23:55:26 -05:00
|
|
|
|
|
|
|
fn not_one(val: usize) -> bool { val != 1 }
|
|
|
|
fn not_two(val: usize) -> bool { val != 2 }
|
|
|
|
|
|
|
|
fn generic_arg<T>(val: T) -> bool { true }
|
|
|
|
|
|
|
|
fn generic<T>(val: usize) -> bool { val != 1 }
|
|
|
|
|
|
|
|
fn main() {
|
2019-11-18 13:57:23 -06:00
|
|
|
let _: Option<Checked<not_one>> = None;
|
|
|
|
let _: Checked<not_one> = Checked::<not_one>;
|
2020-06-12 12:25:14 -05:00
|
|
|
let _: Checked<not_one> = Checked::<not_two>;
|
2019-09-30 23:55:26 -05:00
|
|
|
|
2019-11-18 13:57:23 -06:00
|
|
|
let _ = Checked::<generic_arg>;
|
2019-09-30 23:55:26 -05:00
|
|
|
let _ = Checked::<{generic_arg::<usize>}>;
|
2020-06-12 12:25:14 -05:00
|
|
|
let _ = Checked::<{generic_arg::<u32>}>;
|
2019-09-30 23:55:26 -05:00
|
|
|
|
2020-06-12 12:25:14 -05:00
|
|
|
let _ = Checked::<generic>;
|
2019-09-30 23:55:26 -05:00
|
|
|
let _ = Checked::<{generic::<u16>}>;
|
|
|
|
let _: Checked<{generic::<u16>}> = Checked::<{generic::<u16>}>;
|
2020-06-12 12:25:14 -05:00
|
|
|
let _: Checked<{generic::<u32>}> = Checked::<{generic::<u16>}>;
|
2019-10-02 02:29:16 -05:00
|
|
|
}
|