Bug 24050 – [REG2.101.0] Wrong code with temporary and tuple range foreach

Status
NEW
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2023-07-19T14:43:09Z
Last change time
2024-12-13T19:30:14Z
Keywords
backend, wrong-code
Assigned to
No Owner
Creator
Vladimir Panteleev
Moved to GitHub: dmd#20314 →

Comments

Comment #0 by dlang-bugzilla — 2023-07-19T14:43:09Z
/////////////// test.d ////////////// struct TData { ~this() {} string toGC() { return null; } } struct R { auto front() { return tuple( string.init, TData.init.toGC, ); } enum empty = false; void popFront(){} } void main() { auto aa = R(); string[][string] lookup; foreach (k, v; aa) { lookup[v] ~= null; break; } } alias AliasSeq(TList...) = TList; struct Tuple { AliasSeq!(string, string) expand; alias expand this; } auto tuple(Args...)(Args) { return Tuple.init; } ///////////////////////////////////// Runs OK with 2.100.0, segfaults at runtime with 2.101.0. Introduced in https://github.com/dlang/dmd/pull/14358
Comment #1 by robert.schadek — 2024-12-13T19:30:14Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20314 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB