Bug 9773 – ref parameter with default value should not compile

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-03-21T01:00:00Z
Last change time
2013-05-17T13:01:16Z
Keywords
accepts-invalid, pull
Assigned to
nobody
Creator
alanb

Comments

Comment #0 by alanb — 2013-03-21T01:00:44Z
This should not compile. void f( ref string a = "" ) { a = "crash and burn"; } int main() { f(); // seg fault return 0; }
Comment #1 by k.hara.pg — 2013-04-02T19:33:46Z
Comment #2 by andrej.mitrovich — 2013-04-03T00:10:22Z
(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' }
Comment #3 by github-bugzilla — 2013-04-04T12:58:18Z
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
Comment #4 by github-bugzilla — 2013-05-15T01:10:00Z
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
Comment #5 by github-bugzilla — 2013-05-17T13:01:16Z