You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
libcxx/test/utilities/meta/meta.unary/meta.unary.prop
Howard Hinnant 11a50ac497 Richard Smith: It was pointed out to me off-list that libc++'s non-compiler-builtin
implementation of std::is_polymorphic does this:

template <class _Tp> struct __is_polymorphic1 : public _Tp {};

... and that g++ rejects this if _Tp has an inaccessible virtual destructor
(because __is_polymorphic1<_Tp> would have a deleted virtual destructor
overriding _Tp's non-deleted destructor). Clang was failing to reject this;
I've fixed that in r178563, but that causes libc++'s corresponding test
case to fail with both clang and gcc when using the fallback
implementation. The fallback code also incorrectly rejects final types.

The attached patch fixes the fallback implementation of is_polymorphic; we
now use dynamic_cast's detection of polymorphic class types rather than
trying to determine if adding a virtual function makes the type larger:

  enable_if<sizeof((_Tp*)dynamic_cast<const volatile
void*>(declval<_Tp*>())) != 0, ...>

Two things of note here:
* the (_Tp*) cast is necessary to work around bugs in Clang and g++ where
we otherwise don't instantiate the dynamic_cast (filed as PR15656)
* the 'const volatile' is here to treat is_polymorphic<cv T> as true for a
polymorphic class type T -- my reading of the standard suggests this is
incorrect, but it matches our builtin __is_polymorphic and gcc


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@178576 91177308-0d34-0410-b5e6-96231b3b80d8
13 years ago
..
has_virtual_destructor.pass.cpp license change 15 years ago
is_abstract.pass.cpp license change 15 years ago
is_assignable.pass.cpp A much improved type_traits for C++0x. Not yet done: is_trivially_constructible, is_trivially_assignable and underlying_type. 15 years ago
is_const.pass.cpp license change 15 years ago
is_constructible.pass.cpp A much improved type_traits for C++0x. Not yet done: is_trivially_constructible, is_trivially_assignable and underlying_type. 15 years ago
is_copy_assignable.pass.cpp A much improved type_traits for C++0x. Not yet done: is_trivially_constructible, is_trivially_assignable and underlying_type. 15 years ago
is_copy_constructible.pass.cpp A much improved type_traits for C++0x. Not yet done: is_trivially_constructible, is_trivially_assignable and underlying_type. 15 years ago
is_default_constructible.pass.cpp A much improved type_traits for C++0x. Not yet done: is_trivially_constructible, is_trivially_assignable and underlying_type. 15 years ago
is_destructible.pass.cpp N3142. Many of these traits are just placeholders with medium quality emulation; waiting on compiler intrinsics to do it right. 15 years ago
is_empty.pass.cpp license change 15 years ago
is_literal_type.pass.cpp A much improved type_traits for C++0x. Not yet done: is_trivially_constructible, is_trivially_assignable and underlying_type. 15 years ago
is_move_assignable.pass.cpp A much improved type_traits for C++0x. Not yet done: is_trivially_constructible, is_trivially_assignable and underlying_type. 15 years ago
is_move_constructible.pass.cpp N3142. Many of these traits are just placeholders with medium quality emulation; waiting on compiler intrinsics to do it right. 15 years ago
is_nothrow_assignable.pass.cpp N3142. Many of these traits are just placeholders with medium quality emulation; waiting on compiler intrinsics to do it right. 15 years ago
is_nothrow_constructible.pass.cpp A much improved type_traits for C++0x. Not yet done: is_trivially_constructible, is_trivially_assignable and underlying_type. 15 years ago
is_nothrow_copy_assignable.pass.cpp A much improved type_traits for C++0x. Not yet done: is_trivially_constructible, is_trivially_assignable and underlying_type. 15 years ago
is_nothrow_copy_constructible.pass.cpp A much improved type_traits for C++0x. Not yet done: is_trivially_constructible, is_trivially_assignable and underlying_type. 15 years ago
is_nothrow_default_constructible.pass.cpp A much improved type_traits for C++0x. Not yet done: is_trivially_constructible, is_trivially_assignable and underlying_type. 15 years ago
is_nothrow_destructible.pass.cpp noexcept for <memory>. I've added a few extension noexcept to: allocator_traits<A>::deallocate, allocaate<T>::deallocate, return_temporary_buffer, and default_delete<T>::operator()(T*) const. My rationale was: If a std-dicated noexcept function needs to call another std-defined function, that called function must be noexcept. We're all a little new to noexcept, so things like this are to be expected. Also included fix for broken __is_swappable trait pointed out by Marc Glisse, thanks Marc|. And fixed a test case for is_nothrow_destructible. Destructors are now noexcept by default| 15 years ago
is_nothrow_move_assignable.pass.cpp N3142. Many of these traits are just placeholders with medium quality emulation; waiting on compiler intrinsics to do it right. 15 years ago
is_nothrow_move_constructible.pass.cpp A much improved type_traits for C++0x. Not yet done: is_trivially_constructible, is_trivially_assignable and underlying_type. 15 years ago
is_pod.pass.cpp license change 15 years ago
is_polymorphic.pass.cpp Richard Smith: It was pointed out to me off-list that libc++'s non-compiler-builtin 13 years ago
is_signed.pass.cpp license change 15 years ago
is_standard_layout.pass.cpp A much improved type_traits for C++0x. Not yet done: is_trivially_constructible, is_trivially_assignable and underlying_type. 15 years ago
is_trivial.pass.cpp A much improved type_traits for C++0x. Not yet done: is_trivially_constructible, is_trivially_assignable and underlying_type. 15 years ago
is_trivialially_copyable.pass.cpp A much improved type_traits for C++0x. Not yet done: is_trivially_constructible, is_trivially_assignable and underlying_type. 15 years ago
is_trivially_assignable.pass.cpp N3142. Many of these traits are just placeholders with medium quality emulation; waiting on compiler intrinsics to do it right. 15 years ago
is_trivially_constructible.pass.cpp N3142. Many of these traits are just placeholders with medium quality emulation; waiting on compiler intrinsics to do it right. 15 years ago
is_trivially_copy_assignable.pass.cpp N3142. Many of these traits are just placeholders with medium quality emulation; waiting on compiler intrinsics to do it right. 15 years ago
is_trivially_copy_constructible.pass.cpp Hook up to the new clang __is_trivially_constructible and __is_trivially_assignable traits. Fixes r10925427 and http://llvm.org/bugs/show_bug.cgi?id=12038. 14 years ago
is_trivially_default_constructible.pass.cpp N3142. Many of these traits are just placeholders with medium quality emulation; waiting on compiler intrinsics to do it right. 15 years ago
is_trivially_destructible.pass.cpp N3142. Many of these traits are just placeholders with medium quality emulation; waiting on compiler intrinsics to do it right. 15 years ago
is_trivially_move_assignable.pass.cpp N3142. Many of these traits are just placeholders with medium quality emulation; waiting on compiler intrinsics to do it right. 15 years ago
is_trivially_move_constructible.pass.cpp Hook up to the new clang __is_trivially_constructible and __is_trivially_assignable traits. Fixes r10925427 and http://llvm.org/bugs/show_bug.cgi?id=12038. 14 years ago
is_unsigned.pass.cpp license change 15 years ago
is_volatile.pass.cpp license change 15 years ago