fsharp icon indicating copy to clipboard operation
fsharp copied to clipboard

Can't take address of a struct value and set it to a discard pattern

Open auduchinok opened this issue 5 months ago • 0 comments

When taking an address of a struct value, there's an unexpected error produced when setting it to a wildcard pattern:

module Module

type S =
    struct
        val Field: int
    end

do
    let s = S()

    let _ = &s
    let a = &s

    ()
Image
Program.fs(11,14): Error FS0421 : The address of the variable 's' cannot be used at this point

auduchinok avatar Aug 12 '25 15:08 auduchinok