title: Destructors of builtin types (int, char etc..)
body: <p>In C++ the following code gives a compiler error:</p>
  
  <pre><code>void destruct1 (int * item)
  {
    item-&gt;~int();
  }
  </code></pre>
  
  <p>This code is nearly the same, I just typedef the int to another type and something magic happens:</p>
  
  <pre><code>typedef int myint;
  
  void destruct2 (myint * item)
  {
    item-&gt;~myint();
  }
  </code></pre>
  
  <p>Why does the second code work? Does an int get a destructor just because it has been typedefed?</p>
  
  <p>In case you wonder why one ever would like to do this: This comes from refactoring C++ code. We're removing the standard heap and replacing it with selfmade pools. This requires us to call placement-new and the destructors. I know that calling destructors for primitive types is useless, but we want them in the code nevertheless in case we later replace PODs with real classes.</p>
  
  <p>Finding out that naked int's don't work but typedefed ones do was quite a surprise.</p>
  
  <p>Btw - I have a solution that involves template-functions. We just typedef inside the template and everything is fine.</p>