[Issue 19183] DIP1000 defeated if auto used instead of scope in variable declaration with template this member function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Sep 23 04:37:40 UTC 2019


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

--- Comment #18 from Mike Franklin <slavo5150 at yahoo.com> ---
`scope ptr(this This)() { return ints; }` is ambiguous.

Did you mean `scope int* ptr(this This)() { return ints; }` or `int* ptr(this
This)() scope { return ints; }`

The former is supposed to apply `scope` to the return value while the latter
should `scope` to the implicit `ref this` parameter.  See
https://github.com/dlang/DIPs/blob/master/DIPs/other/DIP1000.md#scope-function-returns

>From your explanation, I assume you're expecting `scope` to be inferred for the
implicit `ref this` parameter, correct?

--


More information about the Digitalmars-d-bugs mailing list