Bug ID: 41843
           Summary: std::is_base_of should give correct result for
                    incomplete unions
           Product: libc++
           Version: 8.0
          Hardware: Macintosh
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs

Created attachment 21928
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

#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
   static_assert(!std::is_base_of_v<Uncomplete, Incomplete>);  // fails to
   static_assert(!std::is_base_of_v<Uncomplete, Uncomplete>);

You are receiving this mail because:
You are on the CC list for the bug.
llvm-bugs mailing list

Reply via email to