Boost C++ Libraries: Ticket #12285: type_traits must assert type completeness for some traits https://svn.boost.org/trac10/ticket/12285 <p> Without that check hard detectable errors are possible: </p> <pre class="wiki">#include &lt;boost/type_traits.hpp&gt; struct foo; void kill_sanity() { (void)boost::is_constructible&lt;foo, foo&gt;::value; } struct foo{}; int main() { static_assert(boost::is_constructible&lt;foo, foo&gt;::value, "foo must be constructible from foo"); // Ooops } </pre><p> All the is_*constructible, is_base_of, is_convertible, is_destructible, is_*swappable, has_virtual_destructor traits must assert completeness. </p> <p> Solution could be to create an asserting structure (pseudocode): </p> <pre class="wiki">template &lt;class T&gt; struct assert_complete { template &lt;class U&gt; yes_type test(mpl::int_&lt;sizeof(U)&gt;* = 0); template &lt;class U&gt; no_type test(...); static_assert(sizeof(test&lt;T&gt;(0)) == sizeof(yes_type), "T must be a complete type!"); }; </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12285 Trac 1.4.3 John Maddock Sun, 04 Feb 2018 19:29:16 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/12285#comment:1 https://svn.boost.org/trac10/ticket/12285#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Nod, there were a few traits which gave incorrect results when instantiated with an incomplete type, fixed in <a class="ext-link" href="https://github.com/boostorg/type_traits/commit/ac351390b215b73d8a9e16d2ca37ba2d9d88a14f"><span class="icon">​</span>https://github.com/boostorg/type_traits/commit/ac351390b215b73d8a9e16d2ca37ba2d9d88a14f</a> (plus a few subsequent commits for older compiler workarounds). </p> Ticket