Stack overflow

Jonathan M Davis jmdavisProg at gmx.com
Mon Jun 25 04:07:07 PDT 2012


On Monday, June 25, 2012 13:01:47 Timon Gehr wrote:
> On 06/25/2012 02:48 AM, Jonathan M Davis wrote:
> > On Sunday, June 24, 2012 19:03:17 Namespace wrote:
> >>> This might work:
> >>> 
> >>> this(U)(U obj)
> >>> 
> >>>      if(is(U : T)&&  !is(U == typeof(null)))
> >>> 
> >>> {
> >>> }
> >>> 
> >>> 
> >>> - Jonathan M Davis
> >> 
> >> Interesting. With or wihtout that, if i add a method to Foo it
> >> prints "Stack overflow" also.
> >> 
> >> http://dpaste.dzfl.pl/91dad66c
> >> 
> >> Can you explain that?
> > 
> > Wait, you have a template mixin inside of Foo which passes Foo to it? I
> > don't know if you can get away with that or not, since you're trying to
> > pass a type to a template while you're adding stuff to it via that
> > template. So, the type is incomplete. I'm willing to be that that's your
> > problem, but I don't know.
> > 
> > - Jonathan M Davis
> 
> This is fine. I am doing it all the time.

If it works, then it works, but it surprises me a bit, given that you can't do 
that with template declarations normally.

> Why are we discussing this compiler bug on the main newsgroup though?

We're not discussing this on the main newsgroup. This is d-learn.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list