[Issue 12287] infinite loop on std.traits.moduleName on templated struct member

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Mar 2 20:35:36 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12287



--- Comment #15 from Kenji Hara <k.hara.pg at gmail.com> 2014-03-02 20:35:34 PST ---
(In reply to comment #14)
> (In reply to comment #13)
> > The semantic will return ScopeExp, and it still contain the TemplateInstance
> > object. So you are misunderstanding.
> 
> I just checked again with a debugger and this is not what I am seeing. The
> returned expression is a TypeExp, with the type being the TypeStruct pointing
> at the struct of course.
> 
> > I don't understand what you saying. The parent of struct S and variable x is
> > the template instance S!int. There's nothing else.
> 
> Maybe I am wrong but from looking at what is going on with a debugger I don't
> see that happening.

Ah, I was wrong. Indeed __traits(parent) will return TypeExp for the
instantiated type of the eponymous template.

> But even if you are right, isn't the correct fix to move the replacing of the
> template instance with the eponymous member so that it doesn't happen with
> chained __traits(parent)?
> 
> Your library solution is a crutch; I don't think there should ever be a case
> where __traits(parent) enters an infinite loop.

I think the library solution is far better than the hack for __traits(parent).

In other word, the infinite loop is the expected behavior with 2.065 Phobos
code.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list