digitalmars.D.bugs - needThis() bug
- Tiago Gasiba (21/21) Oct 24 2005 Hi,
- Lionello Lunesu (8/30) Oct 24 2005 Hi..
- Carlos Santander (5/50) Oct 25 2005 That's the bug: it shouldn't crash the compiler.
- Thomas Kuehne (14/32) Oct 28 2005 -----BEGIN PGP SIGNED MESSAGE-----
Hi, The following code is wrong and makes the compiler crash: ------ CODE ------ class FOO{ struct S { int a; } S st; static int f( int a ){ return st.a; } } ------ CODE ------ Execution: dmd bug.d dmd: tocsym.c:142: virtual Symbol* VarDeclaration::toSymbol(): Assertion `!needThis()' failed. Abgebrochen Tiago -- Tiago Gasiba (MSc.) - http://www.gasiba.de Everything should be made as simple as possible, but not simpler.
Oct 24 2005
Hi.. It's seems a compile error: "st" is a member of the class FOO. You can't reference a member inside a static method, since the static methods has no "this" to work on. You need an instance of FOO to be able to access "st". Unfriendly error message though. L. "Tiago Gasiba" <tiago.gasiba gmail.com> wrote in message news:dji2d3$acl$1 digitaldaemon.com...Hi, The following code is wrong and makes the compiler crash: ------ CODE ------ class FOO{ struct S { int a; } S st; static int f( int a ){ return st.a; } } ------ CODE ------ Execution: dmd bug.d dmd: tocsym.c:142: virtual Symbol* VarDeclaration::toSymbol(): Assertion `!needThis()' failed. Abgebrochen Tiago -- Tiago Gasiba (MSc.) - http://www.gasiba.de Everything should be made as simple as possible, but not simpler.
Oct 24 2005
Lionello Lunesu escribió:Hi.. It's seems a compile error: "st" is a member of the class FOO. You can't reference a member inside a static method, since the static methods has no "this" to work on. You need an instance of FOO to be able to access "st".That's why he said "the following code is wrong"Unfriendly error message though.That's the bug: it shouldn't crash the compiler.L. "Tiago Gasiba" <tiago.gasiba gmail.com> wrote in message news:dji2d3$acl$1 digitaldaemon.com...-- Carlos Santander BernalHi, The following code is wrong and makes the compiler crash: ------ CODE ------ class FOO{ struct S { int a; } S st; static int f( int a ){ return st.a; } } ------ CODE ------ Execution: dmd bug.d dmd: tocsym.c:142: virtual Symbol* VarDeclaration::toSymbol(): Assertion `!needThis()' failed. Abgebrochen Tiago -- Tiago Gasiba (MSc.) - http://www.gasiba.de Everything should be made as simple as possible, but not simpler.
Oct 25 2005
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Tiago Gasiba schrieb am 2005-10-24:Hi, The following code is wrong and makes the compiler crash: ------ CODE ------ class FOO{ struct S { int a; } S st; static int f( int a ){ return st.a; } } ------ CODE ------ Execution: dmd bug.d dmd: tocsym.c:142: virtual Symbol* VarDeclaration::toSymbol(): Assertion `!needThis()' failed. Abgebrochen TiagoAdded to DStress as http://dstress.kuehne.cn/nocompile/b/bug_tocsym_142_A.d http://dstress.kuehne.cn/nocompile/b/bug_tocsym_142_B.d http://dstress.kuehne.cn/nocompile/b/bug_tocsym_142_C.d http://dstress.kuehne.cn/nocompile/b/bug_tocsym_142_D.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFDYaI63w+/yD4P9tIRAl+GAJ96Iyhj5GgaGZsykVuYCEKGP7JliACgv7Dn OYZkHJHgL0aPEVRZvfLkRlE= =A1zX -----END PGP SIGNATURE-----
Oct 28 2005