[Issue 640] New: Strage error messages around structInstance.init

Thomas Kuehne thomas-dloop at kuehne.cn
Sun Dec 10 09:01:11 PST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

d-bugmail at puremagic.com schrieb am 2006-12-03:
> http://d.puremagic.com/issues/show_bug.cgi?id=640

> // credit goes to http://pc8.2ch.net/test/read.cgi/tech/1158013550/956
> struct A { int a; }
> void main() {
>   A x;         // <-- test.d(3)
>
>   x = x.init;
> }
> ----------------
> test.d(3): Error: cannot implicitly convert expression (0) of type int to A
> test.d(3): Error: cannot cast int to A
>
>
> If x=x.init is commented out, or changed to x=A.init, the error disappears.
> Even worse, a slightly modified version crashes dmd (access violation).
>
> struct A { int a; }
> void main() {
>   A x = {0};
>   x = x.init;
> }

Added to DStress as
http://dstress.kuehne.cn/nocompile/b/expression_4154_A.d
http://dstress.kuehne.cn/nocompile/b/expression_4154_B.d
http://dstress.kuehne.cn/run/b/expression_4154_C.d

Thomas


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

iD8DBQFFfEFVLK5blCcjpWoRAudDAJ99lH4s96OIIp3kKTdU4Eab2raSvgCdHlFh
JRhifgfKTSJpL6tdKxLodEE=
=LyJw
-----END PGP SIGNATURE-----


More information about the Digitalmars-d-bugs mailing list