www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Internal Error on void[] = void[]

reply Lukas Pinkowski <Lukas.Pinkowski web.de> writes:
I use DMD 0.113 on Linux and the following snippet

void Foo()
{
  void[] bar;
  void[] foo;
  
  bar.length = 50;
  foo.length = 50;
  
  for(int i=0; i<50; i++)
  {
    foo[i] = bar[i];
  }
}

gives me

Internal error: ../ztc/cod4.c 352

When you comment out
// foo[i] = bar[i]

It'll compile without errors. It gives me the same error, when casting to
void.

Now is this valid D? Or should I use ubyte[] or byte[] instead of void[]?

Greetings,

Lukas
Feb 26 2005
next sibling parent "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
 Now is this valid D? Or should I use ubyte[] or byte[] instead of void[]?
I'm not sure if it's valid to set or get the value of a void, but it certainly shouldn't crash the compiler. You're probably better off using byte[] or ubyte[] instead, because honestly, what IS a void? ;)
Feb 26 2005
prev sibling next sibling parent Derek <derek psych.ward> writes:
On Sat, 26 Feb 2005 17:57:52 +0100, Lukas Pinkowski wrote:

 I use DMD 0.113 on Linux and the following snippet
 
 void Foo()
 {
   void[] bar;
   void[] foo;
   
   bar.length = 50;
   foo.length = 50;
   
   for(int i=0; i<50; i++)
   {
     foo[i] = bar[i];
   }
 }
 
 gives me
 
 Internal error: ../ztc/cod4.c 352
 
 When you comment out
 // foo[i] = bar[i]
 
 It'll compile without errors. It gives me the same error, when casting to
 void.
 
 Now is this valid D? Or should I use ubyte[] or byte[] instead of void[]?
Well, ask yourself, are you copying bytes or copying voids (whatever they are)? -- Derek Melbourne, Australia
Feb 26 2005
prev sibling next sibling parent "Walter" <newshound digitalmars.com> writes:
It isn't valid code, but it shouldn't crash the compiler.
Feb 27 2005
prev sibling parent Thomas Kuehne <thomas-dloop kuehne.thisisspam.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Lukas Pinkowski schrieb am Sat, 26 Feb 2005 17:57:52 +0100:
 I use DMD 0.113 on Linux and the following snippet

 void Foo()
 {
   void[] bar;
   void[] foo;
   
   bar.length = 50;
   foo.length = 50;
   
   for(int i=0; i<50; i++)
   {
     foo[i] = bar[i];
   }
 }

 gives me

 Internal error: ../ztc/cod4.c 352
Added to DStress as http://dstress.kuehne.cn/nocompile/bug_cod4_352_B.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCOorU3w+/yD4P9tIRArTfAJ9vegfYIRnWHjCADEtQDOVdx+G7OwCeNHVx wjDle57aEEqa+ThNlu0jSr0= =5Mfu -----END PGP SIGNATURE-----
Mar 18 2005