[Issue 6759] New: missing initialization in foreach with alias this
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Oct 2 05:03:42 PDT 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6759
Summary: missing initialization in foreach with alias this
Product: D
Version: D2
Platform: Other
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: dawg at dawgfoto.de
--- Comment #0 from dawg at dawgfoto.de 2011-10-02 05:03:02 PDT ---
struct Range
{
size_t front() { return 0; }
void popFront() { empty = true; }
bool empty;
}
struct ARange
{
Range range;
alias range this;
}
void main()
{
ARange arange;
assert(arange.front == 0);
foreach(e; arange)
{}
}
---
Foreach creates a reference to arange.
The expression that initializes the reference is dropped
for alias this aggregates.
This is a regression introduced by
https://github.com/D-Programming-Language/dmd/commit/6a2aefdb468d20aa8d498c8930c2613d78a91238
as a fix to #2781.
--
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