-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Description
| Bugzilla Link | 41843 |
| Resolution | FIXED |
| Resolved on | Jun 17, 2019 08:45 |
| Version | 8.0 |
| OS | All |
| Attachments | Source for failing test |
| CC | @mclow,@zygoloid |
Extended Description
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>);
}