digitalmars.D.bugs - [adress op] sudden AV
- Manfred Nowak (26/26) Apr 22 2005 All asserts should path, but do not:
- Nick (6/23) Apr 22 2005 This is not supposed to work, since the struct S has no link to any inst...
- Thomas Kuehne (11/37) Apr 22 2005 -----BEGIN PGP SIGNED MESSAGE-----
All asserts should path, but do not: <code> class C{ void f(){}; void opCall(){ assert( &f); printf("assert 2 passed.\n"); } struct S{ void opCall(){ assert( &f); printf("assert 3 passed.\n"); } } S s; } void main(){ C c= new C; assert( &(c.f)); printf("assert 1 passed.\n"); c(); c.s(); } </code>
Apr 22 2005
In article <d4apqu$2bo2$1 digitaldaemon.com>, Manfred Nowak says...All asserts should path, but do not: <code> class C{ void f(){}; void opCall(){ assert( &f); printf("assert 2 passed.\n"); } struct S{ void opCall(){ assert( &f); printf("assert 3 passed.\n"); } } S s; } [...]This is not supposed to work, since the struct S has no link to any instance of the class C, and hence no pointer to the function f (f is a virtual function, so without a class instance you have no pointer.) In fact it shouldn't even compile, since f isn't well defined in S. Nick
Apr 22 2005
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Manfred Nowak schrieb am Fri, 22 Apr 2005 12:14:22 +0000 (UTC):All asserts should path, but do not: <code> class C{ void f(){}; void opCall(){ assert( &f); printf("assert 2 passed.\n"); } struct S{ void opCall(){ assert( &f); printf("assert 3 passed.\n"); } } S s; } void main(){ C c= new C; assert( &(c.f)); printf("assert 1 passed.\n"); c(); c.s(); } </code>Added to DStress as http://dstress.kuehne.cn/nocompile/scope_02.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCae7p3w+/yD4P9tIRAqJRAJ4n3D7YtQgNiBTJi+kJy6IsrGnPHgCgjUer G5gVdi3qwHcWwBrg5tK/MdU= =+vxA -----END PGP SIGNATURE-----
Apr 22 2005