Thread overview
template alias bug?
Jan 03, 2006
Johan Granberg
Jan 05, 2006
Thomas Kuehne
Jan 10, 2006
Walter Bright
January 03, 2006
Is this a bug or not? I'm rather new to d so I could hav missed somthing.

typedef Alocator!(Object) GObject;
alias Factory!(Module) GModule;

the above code works fine but this code doesent compile

alias Alocator!(Object) GObject;
alias Factory!(Module) GModule;

It is only the typdef that has changed to an alias so I did not expect
any diference.
/Johan

COMPLETE CODE BELOW AND ATTATCHED
class Module
{
	abstract GObject createObject();
}

class Factory(T):T
{
	override GObject createObject(){}
}

class Object
{
	GModule*gameModule;//most deriverd module

}

class Alocator(T):T
{
	//new();
}

typedef Alocator!(Object) GObject;
//if the above typdef is an alias the folowing error aperes
//bug.d(8): function bug.Factory!(Module).Factory.createObject of type
Alocator() overrides but is not covariant with bug.Module.createObject
of type Alocator!(Object)()
//bug.d(26): template instance bug.Factory!(Module) error instantiating
alias Factory!(Module) GModule;

int main(char[][]argvs)
{
	GModule mod=new GModule();
	return 0;
}


January 05, 2006
Johan Granberg schrieb am 2006-01-03:
> Is this a bug or not? I'm rather new to d so I could hav missed somthing.
>
> typedef Alocator!(Object) GObject;
> alias Factory!(Module) GModule;
>
> the above code works fine but this code doesent compile
>
> alias Alocator!(Object) GObject;
> alias Factory!(Module) GModule;
>
> It is only the typdef that has changed to an alias so I did not expect
> any diference.
> /Johan

> class Module
> {
> 	abstract GObject createObject();
> }
>
> class Factory(T):T
> {
> 	override GObject createObject(){}
> }
>
> class Object
> {
> 	GModule*gameModule;//most deriverd module
> 
> }
>
> class Alocator(T):T
> {
> 	//new();
> }
>
> typedef Alocator!(Object) GObject;
> //if the above typdef is an alias the folowing error aperes
> //bug.d(8): function bug.Factory!(Module).Factory.createObject of type
> Alocator() overrides but is not covariant with bug.Module.createObject
> of type Alocator!(Object)()
> //bug.d(26): template instance bug.Factory!(Module) error instantiating
> alias Factory!(Module) GModule;
>
> int main(char[][]argvs)
> {
> 	GModule mod=new GModule();
> 	return 0;
> }

Added to DStress as http://dstress.kuehne.cn/run/t/template_class_16_A.d http://dstress.kuehne.cn/run/t/template_class_16_B.d http://dstress.kuehne.cn/run/t/template_class_16_C.d http://dstress.kuehne.cn/run/t/template_class_16_D.d http://dstress.kuehne.cn/run/t/template_class_16_E.d http://dstress.kuehne.cn/run/t/template_class_16_F.d http://dstress.kuehne.cn/run/t/template_class_16_G.d http://dstress.kuehne.cn/run/t/template_class_16_H.d http://dstress.kuehne.cn/run/t/template_class_16_I.d

(template_class_16_F.d contains a potential by-pass)

Thomas


January 10, 2006
"Johan Granberg" <lijat.meREM@OVEgmail.com> wrote in message news:dpee4j$m7a$1@digitaldaemon.com...
> Is this a bug or not? I'm rather new to d so I could hav missed somthing.

It's a bug in the compiler, it should diagnose a forward reference to Alocator!(Object).