[Issue 19966] [DIP1000] DIP1000 with a template behaves differently
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Mar 13 09:18:06 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=19966
Walter Bright <bugzilla at digitalmars.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bugzilla at digitalmars.com
--- Comment #1 from Walter Bright <bugzilla at 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.
--
More information about the Digitalmars-d-bugs
mailing list