Thread overview | |||||
---|---|---|---|---|---|
|
December 11, 2017 return ref this -dip1000 | ||||
---|---|---|---|---|
| ||||
This code doesn't compile with -dip1000: struct Foo{ int foo; ref int bar(){ return foo; } } Error: returning `this.foo` escapes a reference to parameter `this`, perhaps annotate with `return` How can be annotated this parameter with 'return ref' ? |
December 11, 2017 Re: return ref this -dip1000 | ||||
---|---|---|---|---|
| ||||
Posted in reply to vit | On Monday, 11 December 2017 at 20:40:09 UTC, vit wrote:
> This code doesn't compile with -dip1000:
>
> struct Foo{
> int foo;
>
>
> ref int bar(){
>
> return foo;
> }
> }
>
> Error: returning `this.foo` escapes a reference to parameter `this`, perhaps annotate with `return`
>
>
> How can be annotated this parameter with 'return ref' ?
struct Foo{
int foo;
ref int bar() return {
return foo;
}
}
|
December 11, 2017 Re: return ref this -dip1000 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Eugene Wissner | On Monday, 11 December 2017 at 20:44:06 UTC, Eugene Wissner wrote:
> On Monday, 11 December 2017 at 20:40:09 UTC, vit wrote:
>> This code doesn't compile with -dip1000:
>>
>> struct Foo{
>> int foo;
>>
>>
>> ref int bar(){
>>
>> return foo;
>> }
>> }
>>
>> Error: returning `this.foo` escapes a reference to parameter `this`, perhaps annotate with `return`
>>
>>
>> How can be annotated this parameter with 'return ref' ?
>
> struct Foo{
> int foo;
>
>
> ref int bar() return {
>
> return foo;
> }
> }
thank you.
|
Copyright © 1999-2021 by the D Language Foundation