Weird DIP1000 issue
ag0aep6g
anonymous at example.com
Wed Feb 8 23:47:26 UTC 2023
On Wednesday, 8 February 2023 at 23:32:16 UTC, Walter Bright
wrote:
> Simplifying your example:
>
>> ref front_p(int* p) { return *p; }
>>
>> void main() @safe
>> {
>> int _errors;
>> front_p(&_errors); /* copy from `ref` via pointer:
>> fails, should work */
>> }
That passes compilation whereas my code fails compilation. So
it's not a proper reduction. Try again.
[...]
> 3. Since `p` is not declared `scope`, the compiler assumes that
> front_p allows `p` to escape. (Inference of attributes does not
> happen for regular functions.)
Attribute inference does happen for `front_p`, because it has no
return type declared.
More information about the Digitalmars-d
mailing list