http://d.puremagic.com/issues/show_bug.cgi?id=7603


Maxim Fomin <ma...@maxim-fomin.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ma...@maxim-fomin.ru


--- Comment #4 from Maxim Fomin <ma...@maxim-fomin.ru> 2012-10-04 21:32:15 PDT 
---
(In reply to comment #1)
> Ow.
> 
> Even this fails:
> 
> void test1(ref int val = 10) {}
> void test2(out int val = 20) {}
> void main() {
>     int x;
>     test1(x);
>     assert(x == 10);
>     test2(x);
>     assert(x == 20);
> }

Why wouldn't this fail? Default arguments are used if no argument is given.
Sine you provide arguments and functions don't modify them, arguments are not
changed. The only modification happens due to parameter storage class out.

 void test1(ref int val = 10) {}
 void test2(out int val = 20) {}
 void main() {
     int x = 5;
     test1(x);
     assert(x == 5);
     test2(x);
     assert(x == 0);
}

Passes both assertions as it should.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to