<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - std::is_base_of should give correct result for incomplete unions"
   href="https://bugs.llvm.org/show_bug.cgi?id=41843">41843</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>std::is_base_of should give correct result for incomplete unions
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libc++
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>8.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>alisdairm@me.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=21928" name="attach_21928" title="Source for failing test">attachment 21928</a> <a href="attachment.cgi?id=21928&action=edit" title="Source for failing test">[details]</a></span>
Source for failing test

C++20 clarifies the expectation for detecting traits that cannot determine a
result due to an incomplete class.  However, is_base_of is expected to
recognize that unions can never have a base class, nor ever be a base class,
and so give the correct result - per the current working draft.

The following code is expected to compile without triggering a static assert. 
For the current clang/libc++, it fails to compile the middle two heterogeneous
assertions:

#include <type_traits>

struct Incomplete;
 union Uncomplete;

int main() {
   static_assert( std::is_base_of_v<Incomplete, Incomplete>);
   static_assert(!std::is_base_of_v<Incomplete, Uncomplete>);  // fails to
compile
   static_assert(!std::is_base_of_v<Uncomplete, Incomplete>);  // fails to
compile
   static_assert(!std::is_base_of_v<Uncomplete, Uncomplete>);
}</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>