[Issue 6969] Forward reference on template class triangle

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Nov 10 01:34:59 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=6969



--- Comment #8 from Rob T <alanb at ucora.com> 2012-11-10 01:34:57 PST ---
(In reply to comment #7)
> (In reply to comment #6)

I get weird behavior if I put in only the alias definitions.

This stuct version compiles, and it probably should because sA and sB are empty
with no circular referencing.

struct sA()
{
    alias sC!() sC1;
}
struct sB
{
    alias  sA!() sA1;
}
struct sC() 
{
    sB s;
}

But adding sA1 into sB will not compile, but I think it should compile because
sA is empty and there's no circular reference back to sC.

struct sA()
{
    alias sC!() sC1;
}
struct sB
{
    alias  sA!() sA1;
    sA1 a;
}
struct sC() 
{
    sB b;
}

In fact it does compile in the non-template version as expected. 

struct sA
{
    alias sC sC1;
}
struct sB
{
    alias  sA sA1;
    sA1 a;
}
struct sC() 
{
    sB b;
}

Finally, closing the loop will not compile as expected

struct sA
{
    alias sC sC1;
    sC1 c; // bang, we're dead.
}
struct sB
{
    alias  sA sA1;
    sA1 a;
}
struct sC() 
{
    sB b;
}

Templates and non-templates are being evaluated inconsistently, so there's
definitely a bug in there somewhere.

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


More information about the Digitalmars-d-bugs mailing list