[Issue 19384] [Codegen] Address of stack temporary is returned
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Sep 6 09:33:35 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=19384
Walter Bright <bugzilla at digitalmars.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Hardware|x86_64 |All
--- Comment #1 from Walter Bright <bugzilla at digitalmars.com> ---
This problem happens on 32 bit code, too. Slightly reduced test case:
void main() {
Vec preds = Vec(0xDEAD);
void* ptr2 = &preds.august();
assert(&preds == ptr2);
}
struct Vec {
uint item;
ref uint august() {
return item;
// commenting next line removes bug
foreach(ref val; range()) return val;
assert(false);
}
}
struct range {
int opApply(scope int delegate(ref uint) dg) { return 0; }
}
--
More information about the Digitalmars-d-bugs
mailing list