www.digitalmars.com         C & C++   DMDScript  

D.gnu - undefined identifier destroy

reply "Mike" <none none.com> writes:
I get the an "undefined identifier destroy" message when trying 
to compile the following with GDC.

void main()
{
     X x = new X();
     destroy(x);
}

...but it compiles fine in DMD 2.065.0.

I'm using a week-old build of 4.8.2.  Is this not implemented yet?

Mike
Mar 26 2014
next sibling parent reply "ketmar" <nobodyherethismailsucks gmail.com> writes:
just checked it with todays GDC git and gcc 4.8.2 — it works ok.
Mar 26 2014
parent reply "Mike" <none none.com> writes:
On Wednesday, 26 March 2014 at 13:27:03 UTC, ketmar wrote:
 just checked it with todays GDC git and gcc 4.8.2 — it works ok.
Thanks for the reply. I just rebuilt, and I get the same error. Are you using the GDC 4.8 branch with GCC 4.8.2? My build is an ARM Cortex-M cross compiler, but the latest Arch Linux 64 GDC package also fails with the same error.
Mar 26 2014
parent "ketmar" <nobodyherethismailsucks gmail.com> writes:
 My build is an ARM Cortex-M cross compiler
that's it. you have to implement it yourself then, 'cause there is no druntime, unfortunately.
Mar 26 2014
prev sibling parent reply Johannes Pfau <nospam example.com> writes:
Am Wed, 26 Mar 2014 13:20:48 +0000
schrieb "Mike" <none none.com>:

 I get the an "undefined identifier destroy" message when trying 
 to compile the following with GDC.
 
 void main()
 {
      X x = new X();
      destroy(x);
 }
 
 ...but it compiles fine in DMD 2.065.0.
 
 I'm using a week-old build of 4.8.2.  Is this not implemented yet?
 
 Mike
Destroy was added to druntime years ago: https://github.com/D-Programming-GDC/GDC/blame/gdc-4.8/libphobos/libdruntime/object_.d#L2257 (It's implemented in the library, so if you want to use it on bare-metal without druntime you'll have to rewrite it ;-)
Mar 26 2014
parent reply "Mike" <none none.com> writes:
On Wednesday, 26 March 2014 at 13:44:56 UTC, Johannes Pfau wrote:
 Am Wed, 26 Mar 2014 13:20:48 +0000
 schrieb "Mike" <none none.com>:

 I get the an "undefined identifier destroy" message when 
 trying to compile the following with GDC.
 
 void main()
 {
      X x = new X();
      destroy(x);
 }
 
 ...but it compiles fine in DMD 2.065.0.
 
 I'm using a week-old build of 4.8.2.  Is this not implemented 
 yet?
 
 Mike
Destroy was added to druntime years ago: https://github.com/D-Programming-GDC/GDC/blame/gdc-4.8/libphobos/libdruntime/object_.d#L2257 (It's implemented in the library, so if you want to use it on bare-metal without druntime you'll have to rewrite it ;-)
Ah! silly me. Thank you. I expected a link error, though, for a missing library function.
Mar 26 2014
parent "ketmar" <nobodyherethismailsucks gmail.com> writes:
 Ah! silly me.  Thank you.  I expected a link error, though, for 
 a missing library function.
destroy() is not a built-in, actually, it's just a template, which calls finalizer (see object.di in GDC source). so compiler have no way to know that it should do something special with this identifier.
Mar 26 2014