digitalmars.D.bugs - [Issue 640] New: Strage error messages around structInstance.init
- d-bugmail puremagic.com (29/29) Dec 03 2006 http://d.puremagic.com/issues/show_bug.cgi?id=640
- Thomas Kuehne (13/30) Dec 10 2006 -----BEGIN PGP SIGNED MESSAGE-----
- d-bugmail puremagic.com (11/11) Apr 27 2007 http://d.puremagic.com/issues/show_bug.cgi?id=640
- d-bugmail puremagic.com (10/11) Jul 12 2007 http://d.puremagic.com/issues/show_bug.cgi?id=640
http://d.puremagic.com/issues/show_bug.cgi?id=640
Summary: Strage error messages around structInstance.init
Product: D
Version: 0.176
Platform: PC
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla digitalmars.com
ReportedBy: kinaba is.s.u-tokyo.ac.jp
// 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;
}
--
Dec 03 2006
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 d-bugmail 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-----
Dec 10 2006
http://d.puremagic.com/issues/show_bug.cgi?id=640
thomas-dloop kuehne.cn changed:
What |Removed |Added
----------------------------------------------------------------------------
OS/Version|Windows |All
fixed URLs:
http://dstress.kuehne.cn/nocompile/e/expression_4154_A.d
http://dstress.kuehne.cn/nocompile/e/expression_4154_B.d
http://dstress.kuehne.cn/run/e/expression_4154_C.d
--
Apr 27 2007
http://d.puremagic.com/issues/show_bug.cgi?id=640
kinaba is.s.u-tokyo.ac.jp changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
The spec introduced at D 2.001/1.017
The .init property for a variable is now based on its type, not its
initializer.
fixed this problem.
--
Jul 12 2007









Thomas Kuehne <thomas-dloop kuehne.cn> 