[Issue 5541] Disallow escaping of references to stack-allocated memory
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jan 31 20:25:09 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5541
yebblies <yebblies at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |yebblies at gmail.com
Resolution| |INVALID
--- Comment #1 from yebblies <yebblies at gmail.com> 2012-02-01 15:25:08 EST ---
(In reply to comment #0)
> But this code compiles and runs with no errors with DMD 2.051. I think DMD has
> to statically disallow code like this too:
>
>
> struct Foo {
> int x;
> }
> Foo* bar() {
> return &(Foo(1));
> }
> void main() {}
Believe it or not, this is valid code. In D struct literals are currently
lvalues, and not allocated on the stack at all. See issue 5889.
--
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