Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
February 20, 2017 Returning the address of a reference return value in @safe code - 2.072 regression? | ||||
---|---|---|---|---|
| ||||
This code compiles with 2.071, but not with 2.072 nor 2.073: ``` struct S { int i; auto ref foo() @safe { return i; } auto bar() @safe { return &foo(); // <-- Error } } void main() { auto s = S(); s.bar(); } ``` The error is: "cannot take address of ref return of this.foo() in @safe function bar". Is this a compiler regression, or is it a bug in the D code? https://issues.dlang.org/show_bug.cgi?id=17213 Thanks, Johan |
February 20, 2017 Re: Returning the address of a reference return value in @safe code - 2.072 regression? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Johan Engelen | On Monday, 20 February 2017 at 20:49:43 UTC, Johan Engelen wrote:
> ...
Yeah, this is another regression caused by DIP1000.
Christ.
|
February 20, 2017 Re: Returning the address of a reference return value in @safe code - 2.072 regression? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jack Stouffer | On Monday, 20 February 2017 at 20:54:31 UTC, Jack Stouffer wrote: > On Monday, 20 February 2017 at 20:49:43 UTC, Johan Engelen wrote: >> ... > > Yeah, this is another regression caused by DIP1000. > > Christ. For the record, the current list of regressions caused by DIP1000 https://issues.dlang.org/show_bug.cgi?id=17213 https://issues.dlang.org/show_bug.cgi?id=17188 https://issues.dlang.org/show_bug.cgi?id=17123 https://issues.dlang.org/show_bug.cgi?id=17117 |
February 21, 2017 Re: Returning the address of a reference return value in @safe code - 2.072 regression? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jack Stouffer | On Monday, 20 February 2017 at 21:05:17 UTC, Jack Stouffer wrote:
> On Monday, 20 February 2017 at 20:54:31 UTC, Jack Stouffer wrote:
>> On Monday, 20 February 2017 at 20:49:43 UTC, Johan Engelen wrote:
>>> ...
>>
>> Yeah, this is another regression caused by DIP1000.
>>
>> Christ.
>
> For the record, the current list of regressions caused by DIP1000
>
> https://issues.dlang.org/show_bug.cgi?id=17213
> https://issues.dlang.org/show_bug.cgi?id=17188
> https://issues.dlang.org/show_bug.cgi?id=17123
> https://issues.dlang.org/show_bug.cgi?id=17117
17117 and 17123 are already fixed on HEAD, no?
So only two regressions remaining - I hope DIP1000 can be used to build new container libraries soon.
|
February 22, 2017 Re: Returning the address of a reference return value in @safe code - 2.072 regression? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Johan Engelen | On Monday, 20 February 2017 at 20:49:43 UTC, Johan Engelen wrote:
> The error is: "cannot take address of ref return of this.foo() in @safe function bar".
Maybe a bugfix in safety system? Should it go through deprecation process?
|
Copyright © 1999-2021 by the D Language Foundation