[Issue 20072] [2.087.0] Mixin templates: no property `somevar` for type `some.Type`, did you mean `some.Type.__anonymous.somevar`?

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jul 23 18:28:11 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=20072

Ethan Watson <gooberman at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|regression                  |blocker

--- Comment #2 from Ethan Watson <gooberman at gmail.com> ---
It's a static foreach problem.

For whatever reason, static foreach is inserting that __anonymous scope. And
generic code cannot deal with it. __traits( parent ) errors for example.

Example code follows:


import std.meta : AliasSeq;
import std.traits : moduleName;

string generateFor( string objectName )()
{
    return "struct " ~ objectName ~ "{ }";
}

alias StructNames = AliasSeq!( "StructOne", "StructTwo", "StructThree" );

static foreach( Name; StructNames )
{
    mixin( generateFor!Name );
}

pragma( msg, moduleName!StructOne );

--


More information about the Digitalmars-d-bugs mailing list