File tree 2 files changed +36
-0
lines changed
2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ const fn make_fn_ptr ( ) -> fn ( ) {
2
+ || { }
3
+ }
4
+
5
+ static STAT : ( ) = make_fn_ptr ( ) ( ) ;
6
+ //~^ ERROR function pointer
7
+
8
+ const CONST : ( ) = make_fn_ptr ( ) ( ) ;
9
+ //~^ ERROR function pointer
10
+
11
+ const fn call_ptr ( ) {
12
+ make_fn_ptr ( ) ( ) ;
13
+ //~^ ERROR function pointer
14
+ }
15
+
16
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error: function pointer calls are not allowed in statics
2
+ --> $DIR/const-fn-ptr.rs:5:19
3
+ |
4
+ LL | static STAT: () = make_fn_ptr()();
5
+ | ^^^^^^^^^^^^^^^
6
+
7
+ error: function pointer calls are not allowed in constants
8
+ --> $DIR/const-fn-ptr.rs:8:19
9
+ |
10
+ LL | const CONST: () = make_fn_ptr()();
11
+ | ^^^^^^^^^^^^^^^
12
+
13
+ error: function pointer calls are not allowed in constant functions
14
+ --> $DIR/const-fn-ptr.rs:12:5
15
+ |
16
+ LL | make_fn_ptr()();
17
+ | ^^^^^^^^^^^^^^^
18
+
19
+ error: aborting due to 3 previous errors
20
+
You can’t perform that action at this time.
0 commit comments