Thread overview | ||||||
---|---|---|---|---|---|---|
|
June 14, 2010 [Issue 4309] New: String literal passed by ref causes segfault | ||||
---|---|---|---|---|
| ||||
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 --- Comment #0 from Lars T. Kyllingstad <bugzilla@kyllingen.net> 2010-06-14 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: ------- |
July 15, 2010 [Issue 4309] String literal passed by ref causes segfault | ||||
---|---|---|---|---|
| ||||
Posted in reply to Lars T. Kyllingstad | 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 --- Comment #1 from Lionello Lunesu <lio+bugzilla@lunesu.com> 2010-07-15 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: ------- |
November 29, 2010 [Issue 4309] String literal passed by ref causes segfault | ||||
---|---|---|---|---|
| ||||
Posted in reply to Lars T. Kyllingstad | http://d.puremagic.com/issues/show_bug.cgi?id=4309 Lars T. Kyllingstad <bugzilla@kyllingen.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jmdavisProg@gmx.com --- Comment #2 from Lars T. Kyllingstad <bugzilla@kyllingen.net> 2010-11-29 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: ------- |
April 29, 2011 [Issue 4309] String literal passed by ref causes segfault | ||||
---|---|---|---|---|
| ||||
Posted in reply to Lars T. Kyllingstad | 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 --- Comment #3 from kennytm@gmail.com 2011-04-29 07:04:04 PDT --- 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: ------- |
Copyright © 1999-2021 by the D Language Foundation