[Issue 9773] ref parameter with default value should not compile

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Apr 3 00:10:24 PDT 2013


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


Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich at gmail.com


--- Comment #2 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-04-03 00:10:22 PDT ---
(In reply to comment #0)
> This should not compile.
> 
> void f( ref string a = "" )
> {
>    a = "crash and burn";
> }
> 
> int main()
> {
> 
>   f(); // seg fault
>   return 0;
> }

P.S. isn't there a way we can put string literals in some kind of ROM on
Windows? It's just insane that it doesn't crash on Windows (ancient problem, I
know):

import std.stdio;

void f(ref string a = "")
{
    a = "crash and burn";
}

void main()
{
    f();
    writeln("");  // 'crash and burn'
}

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


More information about the Digitalmars-d-bugs mailing list