Mixining templates having functions with the same name
Bruno Medeiros
brunodomedeirosATgmail at SPAM.com
Tue Apr 4 12:51:22 PDT 2006
Victor Nakoryakov wrote:
> 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)
>
Hum, seems like a bug to me, do fill a report:
http://d.puremagic.com/bugzilla
--
Bruno Medeiros - CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
More information about the Digitalmars-d
mailing list