diff options
Diffstat (limited to 'tests/ui/consts/const-fn-ptr.rs')
-rw-r--r-- | tests/ui/consts/const-fn-ptr.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/ui/consts/const-fn-ptr.rs b/tests/ui/consts/const-fn-ptr.rs new file mode 100644 index 000000000..b1befdf06 --- /dev/null +++ b/tests/ui/consts/const-fn-ptr.rs @@ -0,0 +1,16 @@ +const fn make_fn_ptr() -> fn() { + || {} +} + +static STAT: () = make_fn_ptr()(); +//~^ ERROR function pointer + +const CONST: () = make_fn_ptr()(); +//~^ ERROR function pointer + +const fn call_ptr() { + make_fn_ptr()(); + //~^ ERROR function pointer +} + +fn main() {} |