[Issue 4309] New: String literal passed by ref causes segfault
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Jun 14 05:20:04 PDT 2010
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 at puremagic.com
ReportedBy: bugzilla at kyllingen.net
--- Comment #0 from Lars T. Kyllingstad <bugzilla at 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: -------
More information about the Digitalmars-d-bugs
mailing list