www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - struct and === Internal error: ..\ztc\cgcs.c 353

reply "Ben Hinkle" <ben.hinkle gmail.com> writes:
struct foo {
  int opEquals(foo x) {
    return this.normalize === x.normalize;
  }
  foo normalize() {
    foo res;
    return res;
  }
}
int main() {
  return 0;
}

The above example produces on windows dmd-0.114:

Internal error: ..\ztc\cgcs.c 353

It compiles if instead of using the normalize function the body of opEquals 
is
return *this === x;
so it looks like the return values from the functions are confusing the === 
operator. It doesn't matter if foo has any data members. 
Feb 28 2005
parent =?UTF-8?B?VGhvbWFzIEvDvGhuZQ==?= writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ben Hinkle wrote:

| struct foo {
|   int opEquals(foo x) {
|     return this.normalize === x.normalize;
|   }
|   foo normalize() {
|     foo res;
|     return res;
|   }
| }
| int main() {
|   return 0;
| }
|
| The above example produces on windows dmd-0.114:
|
| Internal error: ..\ztc\cgcs.c 353
|
| It compiles if instead of using the normalize function the body of
| opEquals is
| return *this === x;
| so it looks like the return values from the functions are confusing
| the ===  operator. It doesn't matter if foo has any data members.

Added to DStress as
http://dstress.kuehne.cn/run/bug_cgcs_353_C.d

Thomas


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (MingW32)

iD8DBQFCMrvJ3w+/yD4P9tIRAtCxAJ0QlfPDdoCnRyK1dFlEIRku6xQ2EgCfRLDG
Fj1lCOy0heF8XPqjb1AXvw4=
=JPcQ
-----END PGP SIGNATURE-----
Mar 12 2005