Friends don't let friends use inout with scope and -dip1000
Atila Neves
atila.neves at gmail.com
Tue Aug 21 14:32:55 UTC 2018
On Tuesday, 21 August 2018 at 11:28:39 UTC, Nicholas Wilson wrote:
> On Tuesday, 21 August 2018 at 10:57:15 UTC, Atila Neves wrote:
>> On Tuesday, 21 August 2018 at 09:50:46 UTC, Atila Neves wrote:
>>> On Monday, 20 August 2018 at 15:55:54 UTC, Kagamin wrote:
>>>> On Monday, 20 August 2018 at 13:02:23 UTC, Atila Neves wrote:
>>>>> On Monday, 20 August 2018 at 12:56:42 UTC, Kagamin wrote:
>>>>> Error: address of variable s assigned to gInt with longer
>>>>> lifetime
>>>>
>>>> Looks safe to me.
>>>
>>> With dmd 2.081.2 on Arch Linux, the code above compiles with
>>> no error message.
>>
>> Never mind, I forgot to use -dip1000. Ok, cool, so _why_ does
>> it work as intended now? Also, if I have to remember to
>> annotate correctly, surely this is a massive hole in @safe
>> dip1000?
>
> MyStruct is not a template, I presume `return` would get
> inferred if it was. But yeah that is annoying.
At the very least then it should fail to compile if I don't add
the relevant annotation, not silently accept buggy code that
isn't memory safe but somehow _is_ `@safe`.
That's the whole point of -dip1000, no? If I get around it by
forgetting something, it's not going to work.
More information about the Digitalmars-d
mailing list