flan/test/programs/bytes-view-write.flan

12 lines
430 B
Plaintext

;;;; A store through (bytes-view "literal") is refused at compile time:
;;;; bytes-view answers a [const u8], because a string literal's bytes are in
;;;; read-only memory, where the store would trap at -O0 and be deleted as
;;;; undefined at -O2. test_acceptance.ml asserts the refusal; nothing here is
;;;; ever built.
(defn main [] i32
(let [v (bytes-view "INSERTIONSORT")]
(set (at v 0) \Z)
(print (str v))
0))