Is a default-generated constructor not required to construct all base classes? <p>I've come across a case in which type-safe c++ produces non-matching ctor/dtors. The following code generates two constructors for A. The default constructor also constructs its base (B), but the default-generated copy/move ctor does not construct B. Later, it destroys B, so we get non-matching ctor/dtor. </p> <p>I've tried this with gcc and clang and both fail. In the gcc bug report forum they suggested this isn't a gcc problem. I may be missing something, but isn't there something odd when type-safe code results in a dtor call for a class that hasn't been constructed?</p> <h2>Program output:</h2> <pre><code>B() -&gt; INSERT: 0x7fff55398b2f ~B() -&gt; ERASE: 0x7fff55398b2f ~B() -&gt; ERASE: 0x7fff55398b40 // &lt;- unmatched dtor call Assertion failed: (!all.empty()), function ~B, file gcc_bug.c, line 20. </code></pre> <p>Code follows:</p> <pre><code>#include &lt;set&gt; #include &lt;iostream&gt; #include &lt;cstdint&gt; #include &lt;cassert&gt; #include &lt;experimental/optional&gt; std::set&lt;std::uintptr_t&gt; all; struct B { B() { std::cerr &lt;&lt; "B() -&gt; INSERT: " &lt;&lt; this &lt;&lt; "\n"; all.insert((std::uintptr_t)this); } ~B() { std::cerr &lt;&lt; "~B() -&gt; ERASE: " &lt;&lt; this &lt;&lt; "\n"; assert(!all.empty()); // FAILS assert(all.find((std::uintptr_t)this) != all.end()); // FAILS all.erase((std::uintptr_t)this); } }; struct A : B {}; static std::experimental::optional&lt;A&gt; f() { A a; return a; } int main() { auto a = f(); return 0; } </code></pre>