Thread overview
[Issue 9773] New: ref parameter with default value should not compile
Mar 21, 2013
Rob T
Apr 03, 2013
Kenji Hara
Apr 03, 2013
Andrej Mitrovic
Apr 04, 2013
Walter Bright
March 21, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9773

           Summary: ref parameter with default value should not compile
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: alanb@ucora.com


--- Comment #0 from Rob T <alanb@ucora.com> 2013-03-21 01:00:44 PDT ---
This should not compile.

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

int main()
{

  f(); // seg fault
  return 0;
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 03, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9773


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2013-04-02 19:33:46 PDT ---
https://github.com/D-Programming-Language/dmd/pull/1829

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 03, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9773


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

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


--- Comment #2 from Andrej Mitrovic <andrej.mitrovich@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: -------
April 04, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9773



--- Comment #3 from github-bugzilla@puremagic.com 2013-04-04 12:58:18 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/706b18758a63715aef4b1821e7b66b1d4e5ee467 fix Issue 9773 - ref parameter with default string literal should not compile

https://github.com/D-Programming-Language/dmd/commit/630e484c7e20cb156bf71404a342a8b98459cfde Merge pull request #1829 from 9rnsr/fix9773

Issue 9773 - ref parameter with default string literal should not compile

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 04, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9773


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 15, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9773



--- Comment #4 from github-bugzilla@puremagic.com 2013-05-15 01:10:00 PDT ---
Commit pushed to 2.063 at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/fe00d71443844f0261e0dd39b9c97ed3172b8527 Merge pull request #1829 from 9rnsr/fix9773

Issue 9773 - ref parameter with default string literal should not compile

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 17, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9773



--- Comment #5 from github-bugzilla@puremagic.com 2013-05-17 13:01:16 PDT ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/fe00d71443844f0261e0dd39b9c97ed3172b8527 Merge pull request #1829 from 9rnsr/fix9773

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