summaryrefslogtreecommitdiffstats
path: root/src/test/ui/consts/const-fn-ptr.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/consts/const-fn-ptr.rs')
-rw-r--r--src/test/ui/consts/const-fn-ptr.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/test/ui/consts/const-fn-ptr.rs b/src/test/ui/consts/const-fn-ptr.rs
new file mode 100644
index 000000000..b1befdf06
--- /dev/null
+++ b/src/test/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() {}