File tree Expand file tree Collapse file tree 4 files changed +14
-2
lines changed
testsuite/tests/typing-layouts Expand file tree Collapse file tree 4 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -159,7 +159,7 @@ let ocaml_release = {
159
159
160
160
(* Optimization *)
161
161
162
- external opaque_identity : 'a -> 'a = "%opaque"
162
+ external[@layout_poly] opaque_identity : ('a : any). 'a -> 'a = "%opaque"
163
163
164
164
module Immediate64 = struct
165
165
module type Non_immediate = sig
Original file line number Diff line number Diff line change @@ -415,7 +415,7 @@ val runtime_warnings_enabled: unit -> bool
415
415
416
416
(* * {1 Optimization} *)
417
417
418
- external opaque_identity : 'a -> 'a = " %opaque"
418
+ external[ @ layout_poly] opaque_identity : ('a : any ). 'a -> 'a = " %opaque"
419
419
(* * For the purposes of optimization, [opaque_identity] behaves like an
420
420
unknown (and thus possibly side-effecting) function.
421
421
Original file line number Diff line number Diff line change @@ -58,3 +58,10 @@ let () =
58
58
Printf. printf " %s\n " (revapply " abcde" (fun x -> x));
59
59
()
60
60
61
+ let () =
62
+ Printf. printf " %s\n " (N. to_string (Sys. opaque_identity #1n ));
63
+ Printf. printf " %s\n " (I32. to_string (Sys. opaque_identity #2l ));
64
+ Printf. printf " %s\n " (I64. to_string (Sys. opaque_identity #3L ));
65
+ Printf. printf " %s\n " (F. to_string (Sys. opaque_identity #4. ));
66
+ Printf. printf " %s\n " (Sys. opaque_identity " abcde" );
67
+ ()
Original file line number Diff line number Diff line change 23
23
3
24
24
4.
25
25
abcde
26
+ 1
27
+ 2
28
+ 3
29
+ 4.
30
+ abcde
You can’t perform that action at this time.
0 commit comments