digitalmars.D.bugs - Bizarre Exception/Throwing/Templates/Something else Bug Pt II (Ready for Walter)
- John Demme (13/13) Dec 05 2005 OK, so I've spent all evening whiddling this one down, and I've distille...
- Thomas Kuehne (11/80) Dec 10 2005 -----BEGIN PGP SIGNED MESSAGE-----
- Thomas Kuehne (16/32) Dec 16 2005 -----BEGIN PGP SIGNED MESSAGE-----
OK, so I've spent all evening whiddling this one down, and I've distilled it to the attached, the only dependency being phobos. The output should be: before except caught However, it is: before except Error: uups If line 51 is commented out, it works. If any of the method bodies in the parameterized classes is deleted, it also works. Although I've managed to get the test case this small, I'm not smart enough to generalize it. Anybody see the pattern? It doesn't seem obvious to me. ~John Demme
Dec 05 2005
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 John Demme schrieb am 2005-12-06:OK, so I've spent all evening whiddling this one down, and I've distilled it to the attached, the only dependency being phobos. The output should be: before except caught However, it is: before except Error: uups If line 51 is commented out, it works. If any of the method bodies in the parameterized classes is deleted, it also works. Although I've managed to get the test case this small, I'm not smart enough to generalize it. Anybody see the pattern? It doesn't seem obvious to me. ~John Demmeimport std.cstream; import std.array; abstract class Container(V) { public abstract int opApply(int delegate(inout V) dg); } public abstract class MutableList(V): Container!(V) { public abstract MutableList insertBefore(int i, V item); public abstract MutableList append(V item); public abstract MutableList append(Container!(V) items); public abstract MutableList prepend(Container!(V) items); } class AbstractMutableList(V): MutableList!(V) { public MutableList!(V) append(Container!(V) items) { foreach(V item; items) { MutableList!(V).append(item); } return this; } public MutableList!(V) prepend(Container!(V) items) { int i=0; foreach(V item; items) { insertBefore(i++, item); } return this; } } public class ArrayList(V): AbstractMutableList!(V) { private V[] myArray; this(Container!(V) items) { try { foreach(V item; items) { myArray ~= item; } } catch (ArrayBoundsError e) { throw new Exception(e.toString); } } } class CommandLine { // comment/uncomment the following line ArrayList!(int) paramList; } int main( char[][] args ) { return 0; } unittest { void testBoolParam() { try { dout.writefln("before except"); throw new Exception( "uups" ); } catch (Object o) { dout.writefln("caught"); } } testBoolParam(); }Am I missing something or is there any non-abstract version of MutableList.insertBefore? Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFDmsOe3w+/yD4P9tIRAuoXAKCqZ0nawGjy6sJQcH6FsFWIQB7zFgCgzEHS RIiYRJNFmDBuWSeLojZCx4k= =U0PH -----END PGP SIGNATURE-----
Dec 10 2005
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 John Demme schrieb am 2005-12-06:--nextPart8053964.NWeQqG34Qg Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8Bit OK, so I've spent all evening whiddling this one down, and I've distilled it to the attached, the only dependency being phobos. The output should be: before except caught However, it is: before except Error: uups If line 51 is commented out, it works. If any of the method bodies in the parameterized classes is deleted, it also works. Although I've managed to get the test case this small, I'm not smart enough to generalize it. Anybody see the pattern? It doesn't seem obvious to me. ~John DemmeAdded to DStress as http://dstress.kuehne.cn/run/o/odd_bug_04_A.d http://dstress.kuehne.cn/run/o/odd_bug_04_B.d http://dstress.kuehne.cn/run/o/odd_bug_04_C.d http://dstress.kuehne.cn/run/o/odd_bug_04_D.d http://dstress.kuehne.cn/run/o/odd_bug_04_E.d http://dstress.kuehne.cn/run/o/odd_bug_04_F.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFDnWcj3w+/yD4P9tIRAj8KAKCGaxuSMLqvBYv6prxI/zZQLka1xgCgvT23 Cm4oKjA5b0PsHQgQbIs64Xs= =tBCo -----END PGP SIGNATURE-----
Dec 16 2005