[Issue 24157] New: [REG2.105] class `this` as lvalue leads to memory corruption
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Sep 25 16:29:34 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=24157
Issue ID: 24157
Summary: [REG2.105] class `this` as lvalue leads to memory
corruption
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: regression
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: kinke at gmx.net
This assertion fails since v2.105:
```
class Promise {
auto ref unshared() shared {
return cast() this;
}
}
pragma(msg, typeof(&Promise.unshared));
void smashStack() {
char[64] blub;
}
void main() {
shared p = new Promise;
Promise* u = &p.unshared();
smashStack();
assert(*u is cast() p);
}
```
Almost certainly introduced by the (IMO totally controversial)
https://github.com/dlang/dmd/pull/15389.
--
More information about the Digitalmars-d-bugs
mailing list