DIP 36: Rvalue References

Namespace rswhite4 at googlemail.com
Mon Apr 22 01:23:37 PDT 2013


>> If I read the ambiguous wording of the proposal correctly, the 
>> following code will be disallowed:
>>
>> void foo1(scope ref int x) { }
>>
>> void main(){
>>    foo1(1); // error
>> }
>
> My impression is that this would be allowed, not disallowed.
>
>> But this will be fine:
>>
>> void foo1(scope ref int x) { }
>> int bar(){ return 1; }
>>
>> void main(){
>>    foo1(bar());
>> }
>
> I think this would also be allowed.

Yes, both cases are allowed. Dicebot initially wanted that scope 
ref does not accept literals (only in ref should this do), but 
Kenji has convinced him that this is unnecessary.
In the current pull of Kenji both cases works fine.
I also have taken the time and added the overload rules to the 
DIP.


More information about the Digitalmars-d mailing list