You know how I was saying in my DConf talk...

Ethan gooberman at gmail.com
Wed Jul 24 01:06:18 UTC 2019


On Wednesday, 24 July 2019 at 00:51:35 UTC, Timon Gehr wrote:
> This shouldn't happen (the anonymous scope is an implementation 
> detail and `__traits(parent, ...)` shouldn't return it, 
> especially not for symbols that are not even `static foreach` 
> loop variables). Is there already an issue for this? Also, this 
> code compiles neither with 2.086.1 nor 2.087.0. Do you have an 
> example that demonstrates a regression?

The entire point of that code I posted and the bug report I made 
is *to illustrate* that static foreach is broken. *OF COURSE* it 
shouldn't happen.

And it shouldn't be this hard for an end user to work out what 
the problem is.

2.086.1 and 2.087.0 are the versions I've been developing on. 
Take the code, run it in prior DMDs. You'll find where it broke. 
I legit just pasted it in to godbolt and clicked on prior LDCs, 
it's been there as long as LDC has supported static foreach (ldc 
1.6.0 based on dmd 2.076.1)

Herringway on IRC even made a version without dependencies:

static foreach( Name; [""] )
{
     struct StructOne {}
}

struct Z {
     static foreach( Name; [""] )
     {
         struct StructOne {}
     }
}
pragma(msg, __traits(parent, StructOne).stringof);
pragma(msg, __traits(parent, Z.StructOne).stringof);


More information about the Digitalmars-d mailing list