[Issue 19966] [DIP1000] DIP1000 with a template behaves differently
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Mar 13 09:28:12 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=19966
--- Comment #3 from Walter Bright <bugzilla at digitalmars.com> ---
> 1. `Foo` as a template and as a non-template struct behaves differently
What's happening is that when `Foo` is a template, then inference happens with
`foo()`, which infers that `this.bar` is being returned, not `this`. You can
verify this by removing the function body for `foo()` so inference cannot
happen, and then the error appears, because without inference the `return`
applies to `this`, not `this.bar`.
Not a bug.
--
More information about the Digitalmars-d-bugs
mailing list