https://bugs.llvm.org/show_bug.cgi?id=41843
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
Assignee: unassignedclangb...@nondot.org
Reporter: alisda...@me.com
CC: llvm-bugs@lists.llvm.org, mclow.li...@gmail.com
Created attachment 21928
--> https://bugs.llvm.org/attachment.cgi?id=21928&action=edit
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>);
}
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs