Closed
Description
This is a bug in ref-return safety checking, a missing error for negative test case https://github.com/Microsoft/visualfsharp/pull/1367/files#diff-59ae1d2137d6b7479475f5d1287557d9L13
For most cases of returning byrefs we correctly report an error, e,g
let negTest5() =
let mutable x = 0
let addr = &x
&addr
But not for this case:
Repro steps
Compile this code:
module Test
[<Struct>]
type Struct(initial:int) =
let mutable x = initial
member __.AddrX = &x
member __.IncrX() = x <- x + 1
let negTest7() =
let mutable iterator = Struct(0)
iterator.AddrX
Expected behavior
We expect an error to be reported
Actual behavior
No error is reported