https://issues.dlang.org/show_bug.cgi?id=19966

Walter Bright <bugzi...@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzi...@digitalmars.com

--- Comment #1 from Walter Bright <bugzi...@digitalmars.com> ---
> 2. I think the above code is actually valid because it's not provable that 
> `foo` escapes a pointer to the internal state of `Foo`

It's not valid because foo() is defined as returning a pointer that is
equivalent to foo()'s `this` pointer. Then, `a = f.foo;` is treated as
assigning the address of `f` to `a`, a global, which is an error. The compiler
is behaving correctly for this point.

--

Reply via email to