Skip to content

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

Description

@auduchinok

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-Compiler-CheckingType checking, attributes and all aspects of logic checkingArea-Compiler-Checking-Byrefbyref, inref, outref, byref-like types, NativePtr, function pointers, struct semanticsBug

    Type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions