Non-POD object with common linkage: what's supposed to happen?
<p>Someone here wrote the following, at file scope:</p>

<pre><code>std::auto_ptr&lt;ClassWithDestructor&gt; an_auto_ptr;
</code></pre>

<p>They <em>meant</em> to add <code>static</code> but neglected it.</p>

<p>Then, two different linux shared libraries, each containing the .o containing this declaration, ended up linked to an executable.</p>

<p>The <code>auto_ptr::~auto_ptr</code> for this item ran twice, with unfortunate consequences.</p>

<p>Is this defined behavior, undefined behavior, or a gcc+ld bug?</p>
