title: Absolutely bizarre compiler behavior - constructor not getting called.
body: <p>I have a class named <a href="http://bazaar.launchpad.net/~george-edison55/nitroshare/nitroshare0.3/view/head:/libnitrosharenet/include/nitrosharenet/fileserver.h" rel="nofollow"><code>NitroShare::FileServer</code></a> that has two constructor:</p>
  
  <pre><code>FileServer(QObject * parent = NULL);
  FileServer(const Certificate &amp; certificate, QObject * parent = NULL);
  </code></pre>
  
  <p>The implementation of the first constructor is <a href="http://bazaar.launchpad.net/~george-edison55/nitroshare/nitroshare0.3/view/head:/libnitrosharenet/src/server/fileserver.cpp" rel="nofollow">here</a> (line 29):</p>
  
  <pre><code>FileServer::FileServer(QObject * parent)
      : QObject(parent), d(new FileServerPrivate(this))
  {
      qDebug("Constructor invoked!");
  }
  </code></pre>
  
  <p>This class is a member of another class named <a href="http://bazaar.launchpad.net/~george-edison55/nitroshare/nitroshare0.3/view/head:/nitroshare-client/src/nitroshareclient.h" rel="nofollow"><code>NitroShareClient</code></a>:</p>
  
  <pre><code>NitroShare::FileServer server;
  </code></pre>
  
  <p>So, one would assume that the first constructor above would be called when an instance of the <code>NitroShareClient</code> class is created. However, it isn't. And consequently, the program crashes.</p>
  
  <p>Here's where things go from frustrating to truly bizarre: if I replace the constructor declaration in the first line above with:</p>
  
  <pre><code>FileServer(QObject * parent = NULL) : d(NULL) { qDebug("Constructor invoked!"); }
  </code></pre>
  
  <p>...the constructor <em>actually is invoked!</em> Same signature. Same parameters. Same body. The only difference is the location of the function definition.</p>
  
  <p>Can anyone explain what's going on here? If it helps, I'm using GCC 4.7 on Linux.</p>