dotnet / dotnet/fsharp

copyOfStruct error when setting a property returned from a function

Open
#8,899 3 comments 0 reactions 1 assignee Claimed by @dsyme View on GitHub
Area-Compiler-Checking Area-Compiler-Checking-Byref Bug Impact-Medium
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 11h
Merged PRs (30d)
131

Description

See also https://github.com/dotnet/fsharp/issues/8069 which is being treated as a duplicate of this

```
module Bug

type Q() =
member val t = 0 with get, set

let f c x = c () <- x

let q = Q()
f (fun _ -> q.t) 2
```

```
1>C:\Users\Marko\Source\Repos\Lithe\Lithe\bug.fs(6,13): error FS0971: Undefined value 'copyOfStruct : 'a ref'
```

This only gives me an error at build time, not in VS.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.