[Dlang-internal] DIP1000 discussion and testing
Mathias Lang via Dlang-internal
dlang-internal at puremagic.com
Wed Nov 23 03:05:58 PST 2016
On Wednesday, 23 November 2016 at 03:25:20 UTC, Walter Bright
wrote:
> I understand your point. The trouble is, it will break too much
> code.
Maybe I am missing something here: I didn't consider it as
breaking more code than it's `@safe` counterpart.
>> I found that the following code compiles:
>> [...]
> I get:
>
> bug9.d(7): Error: cannot return non-void from void function
My bad, I tried to reduce the snippet a bit more and broke it :)
Here's the corrected version:
```
void main () @safe
{
int x;
void* escape = bar(&x);
}
void* bar (scope void* x) @safe
{
return fun(&x);
}
void* fun (scope void** ptr) @safe
{
return *ptr;
}
```
Using the top of your branch, that is:
b8df860 allow 'return' attribute on nested functions (68 minutes
ago) <Walter Bright>
More information about the Dlang-internal
mailing list