[Issue 24050] New: [REG2.101.0] Wrong code with temporary and tuple range foreach
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jul 19 14:43:09 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=24050
Issue ID: 24050
Summary: [REG2.101.0] Wrong code with temporary and tuple range
foreach
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: wrong-code
Severity: regression
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: dlang-bugzilla at thecybershadow.net
/////////////// 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
--
More information about the Digitalmars-d-bugs
mailing list