On 2012-05-19 09:05, Philippe Sigaud wrote: > On Fri, May 18, 2012 at 11:51 PM, Simen Kjaeraas <simen.kja...@gmail.com> > wrote: > >> Because Wrapper!(AliasStruct).Wrap does not exist. And _error_ is not >> equal to any other type. > > Yes. Wrap is included in the complete template name (Wrapper!(Wrap)) > and has no independent existence. > You _can_ get access to it by exposing it as an alias, as you do in > AliasStruct: > > struct Wrapper(Wrap) > { > alias Wrap Wrapped; // cannot call it 'Wrap' > ... > > }
Yes, of course you are right. This was my fault - after exposing it via an alias, it prints true. > (third case) >>> false >> >> >> And here I disagree. This prints true on 2.059. Regression? > > AFAICT, this should print true. > > And, concerning Artur questio, on 2.059 (Linux): > > pragma(msg, is(w._wrap.Alias == AliasStruct.Alias));// -> true > pragma(msg, typeof(w._wrap).Alias.stringof); // -> MyStruct > pragma(msg, AliasStruct.Alias.stringof); // -> MyStruct I would open a bug report with the following code which is a bit smaller than my first wrong version: ===================== module main; struct MyStruct { } struct AliasStruct { alias MyStruct Alias; } struct Wrapper { AliasStruct aliasStruct; } void main() { Wrapper w; pragma(msg, typeof(w.aliasStruct).Alias.stringof); // -> "MyStruct" pragma(msg, AliasStruct.Alias.stringof); // -> "MyStruct" static assert(is(typeof(w.aliasStruct) == AliasStruct)); // -> true static assert(is(typeof(w.aliasStruct).Alias == AliasStruct.Alias)); // -> false } ===================== Best regards, Matthias