digitalmars.D.bugs - [Issue 4309] New: String literal passed by ref causes segfault
- d-bugmail puremagic.com (29/29) Jun 14 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4309
- d-bugmail puremagic.com (25/25) Jul 15 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4309
- d-bugmail puremagic.com (10/10) Nov 29 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4309
- d-bugmail puremagic.com (14/14) Apr 29 2011 http://d.puremagic.com/issues/show_bug.cgi?id=4309
http://d.puremagic.com/issues/show_bug.cgi?id=4309 Summary: String literal passed by ref causes segfault Product: D Version: D2 Platform: Other OS/Version: Linux Status: NEW Keywords: accepts-invalid Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: bugzilla kyllingen.net 05:20:01 PDT --- The following compiles, but causes a segmentation fault when run: void foo(ref string s) { s = "hello yourself"; // Anything that changes s will do. } void main() { foo("hello"); } I'm guessing that the compiler should catch this and provide an error saying "hello" is not an lvalue. At least that's what it does if one tries something similar with an array literal. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 14 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4309 Lionello Lunesu <lio+bugzilla lunesu.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lio+bugzilla lunesu.com OS/Version|Linux |All 07:03:05 PDT --- You're lucky if it segfaults. On Windows, it changes my literals, even dupped ones: --------- refs.d void X(ref string s) { assert(s[0] == 'a'); s = s[1..$]; } void main() { X("ab"); X("ab"); } core.exception.AssertError refs(3): Assertion failure Digital Mars D Compiler v2.047 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 15 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4309 Lars T. Kyllingstad <bugzilla kyllingen.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jmdavisProg gmx.com 05:03:02 PST --- *** Issue 5289 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 29 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4309 kennytm gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |kennytm gmail.com Resolution| |DUPLICATE This problem arises because a string literal *is* treated as an lvalue currently. *** This issue has been marked as a duplicate of issue 4539 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 29 2011