2019-09-29 19:22:18 -04:00
|
|
|
#![feature(const_extern_fn)]
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
fn regular_in_block();
|
|
|
|
}
|
|
|
|
|
2020-09-01 17:28:11 -04:00
|
|
|
const extern "C" fn bar() {
|
2019-09-29 19:22:18 -04:00
|
|
|
unsafe {
|
|
|
|
regular_in_block();
|
2021-12-10 01:10:05 +08:00
|
|
|
//~^ ERROR: cannot call non-const fn
|
2019-09-29 19:22:18 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-01 17:28:11 -04:00
|
|
|
extern "C" fn regular() {}
|
2019-09-29 19:22:18 -04:00
|
|
|
|
2020-09-01 17:28:11 -04:00
|
|
|
const extern "C" fn foo() {
|
2019-09-29 19:22:18 -04:00
|
|
|
unsafe {
|
|
|
|
regular();
|
2021-12-10 01:10:05 +08:00
|
|
|
//~^ ERROR: cannot call non-const fn
|
2019-09-29 19:22:18 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|