Mixining templates having functions with the same name

Victor Nakoryakov nail-mail at mail.ru
Mon Apr 3 23:41:48 PDT 2006


John Demme wrote:
> The above code compiles, links, and runs fine with DMD 0.150 on Linux.

Ooops, forgot one line... following code doesn't compile:

template T1()
{
         void myproperty(real x) // line X
         {

         }
}

template T2()
{
         real myproperty() // line Y
         {
                 return 5;
         }
}

class C(alias M1, alias M2)
{
         mixin M1!();
         mixin M2!();

}

void main()
{
         auto c = new C!(T1,T2);
         c.myproperty = 0;
}

dmd ../test
..\test.d(8): function test.C!(T1,T2).C.mixin M1!();
.myproperty conflicts with test.C!(T1,T2).C.mixin M2!();
.myproperty at ..\test.d(16)

-- 
Victor (aka nail) Nakoryakov
nail-mail<at>mail<dot>ru

Krasnoznamensk, Moscow, Russia



More information about the Digitalmars-d mailing list