www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - template specialization bug

reply "Aleksey Bobnev" <uw front.ru> writes:
Specialization gets broken sometimes. It's possibly related to module
facility in D.

this works ok(outputs "1 0"):

template IsArray(T)        { static const bool IsArray = false; }
template IsArray(T : T[])  { static const bool IsArray = true; }

void main()
{
    printf("%d %d\n",IsArray!(int[]),IsArray!(int));
}

1. When some module, containing a bunch templates is imported,output is "0
0".
2. When template IsArray is moved into another module, containing other
templates as well,  output is "0 0".

However when I tried to isolate the bug by removing uninvolved templates, it
disappeared.
So I am including the complete code which causes the described behaviour.


begin 666 thor_bug.zip
M4$L#!!0````(`+66F3&!O.LE 0```- ````$````;VLN9(6-L0K",!B$]T#>
MX2P4$O )+ Z.[MVTPV^30B!-2O(KE-)W-V(=Q,';[KC[CNTX>6*+<SZE1+-J
M-38MR$SL>O0Q9,8M1O]IX8B!?+8-5BE^$3B O73Z'X+3_4V0XA&=P4 N*"W%
M\DI0-"47>%!5;5";:ZCVVW:G2EX.OKS6C13K$U!+`P0*``````"7EIDQ````
M````````````!0```%1H;W(O4$L#!!0````(`#R5F3%W%P8W6 $``"8#```+
M````5&AO<B]M971A+F2-D,U.`C$4A?>3S#N<L.)7P. &X )%5V!,G!?H="[0
MT&G'MH..QG>W0P,8#.!FTIR>^\UWVV_'$0`D*VW0PQ1S<JPP>FE8G NUQ$RD
MAIDJM#9DK- *GV1T2)J\A>O!X*;G/[>82%I;JG"O4T6;. J=ES*5 F.J<R94
MB'8_96IML=1P>A2BB<H,B1KTP>JCY:776G YEN7"L%024JW7:,QU1D;AH=/!
ME*Q8J ;\!&9Z+2"#]!Y9X<D(LJ1V++]AH>VNU\7[2O 5&'<ED[)"X9<D,I0A
M)\=ZO]]#*$SCJ-V/HUQGI:3MRUW5M7&]+Y?,6CR74B9Q]!5'WW7H*"\D<X3'
M-\]O)H-N,FSYZ^#'M;*N7DJ&>]QAP:2E\9EIC) ,SB*<*?\27DD2=TE54'-;
MYET<R3 IF/7AH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6G,'1R==X5,D++2-_E&K+N'HJK-\DHB%
MWM,_;MTM'!WVIT^3L=#"^B=67,/1;9_; )"%7M _M>8>CLX[YB:D++35_IE5
M%W'LHOMN1,Q"C^Z?6W<3QXYZ^6;D++3\_LM[_B;$<>SNW: A00OO$*,U[Q"_
M`5!+`P04````" "VEIDQ$K9G4),```#I````" ```'=R;VYG,2YDA8_!"L(P
M$$3OA?S#6" D('Z Q8-'[[E5#[%-,9 F(5F%4OKO)E / N#<9MA].VNFX"-!
M/GP\T!RT-8E:5K&*]!2L(HU+.L>H9BX%-BU(I,CTZ+U+A+OW]C.%$T9EDVZQ
M_D+ "-G=Q#\$Q6<AE!HO;P9,RC N6+64!%DA&D<CKYL!S7!U]7[;W?&<YP-?
M7HC\T/H&4$L#!!0````(`$*%FS$Q'FF&: ```*0````(````=W)O;F<R+F1U
MC3$* # 0!/N#^T,4A 3$#UA9VMNI12"(5YC(&001_VY4%"W<; =FEX;1L1=5
M[SCSK,E/.0+"[,B(09.5"F%%$"$CD_6=C!,C$M/8."VG EDOD0R\;M6G*Y7_
M6-7Y<DL97=(;/_#8V!!V4$L!`A0`% ```` `M9:9,8&\ZR6!````T ````0`
M``````````` `````````&]K+F102P$"% `*``````"7EIDQ````````````
M````!0```````````! ```"C````5&AO<B]02P$"% `4````" `\E9DQ=Q<&
M-UH!```F`P``"P```````````" ```#&````5&AO<B]M971A+F102P$"% `4
M````" ".F9DQ;<[-$4 "``#&! ``#0```````````" ```!)` ``5&AO<B]T
M<F%I=',N9%!+`0(4`!0````(`"F6F3%O(MI0O0,``( >```/````````````
M( ```+0$``!4:&]R+W1Y<&5L:7-T+F102P$"% `4````" "VEIDQ$K9G4),`
M``#I````" ```````````" ```">" ``=W)O;F<Q+F102P$"% `4````" !"
MA9LQ,1YIAFH```"D````" ```````````" ```!7"0``=W)O;F<R+F102P4&
2``````<`!P""`0``YPD`````
`
end
Dec 27 2004
parent "Thomas Kuehne" <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Added to DStress as
http://dstress.kuehne.cn/run/template_10.d
http://dstress.kuehne.cn/run/template_11.d
http://dstress.kuehne.cn/run/template_12.d

Thomas


-----BEGIN PGP SIGNATURE-----

iD8DBQFB1ixn3w+/yD4P9tIRAubFAKC2Hpcw8S1eKC0qUs825IzIIOKXEwCguO3e
w+IkzgTEGHGbOHUF5GOKJ9U=
=oS/a
-----END PGP SIGNATURE-----
Dec 31 2004