How to debug broken inference?

Steven Schveighoffer schveiguy at gmail.com
Fri May 1 23:00:10 UTC 2020


On 5/1/20 6:46 PM, welkam wrote:
> On Friday, 1 May 2020 at 21:04:34 UTC, Steven Schveighoffer wrote:
>>
>> char[4] buf;
>>
>> auto slice = buf.ptr[idx .. buf.length];
> 
> onlineapp.d(3): Error: buf.ptr cannot be used in @safe code, use &buf[0] 
> instead
> 

Yes, I know. That doesn't happen in my full use case. Which is why I 
said I need to dustmite it.

But what I did find is that once I changed that line, then it infers @safe.

Essentially, there's a bug in the compiler that has to do with my whole 
project.

-Steve


More information about the Digitalmars-d mailing list