llvm-project/libcxx/test/utilities
Howard Hinnant 575e4e3650 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

llvm-svn: 178576
2013-04-02 21:25:06 +00:00
..
allocator.adaptor Test adjustment for recent changes in allocator_traits 2010-12-10 19:22:37 +00:00
date.time license change 2010-11-16 22:09:02 +00:00
function.objects This is a start at making the libc++ test suite friendlier to the -fnoexceptions flag. Although this is not a complete solution, it does reduce the number of test failures on OS X from 467 to 128 on OS X when -fno-exceptions is enabled, and does not impact the number of failures at all when -fno-exceptions is not enabled. The bulk of this code was donated anonymously. 2013-03-23 17:27:16 +00:00
memory This is a start at making the libc++ test suite friendlier to the -fnoexceptions flag. Although this is not a complete solution, it does reduce the number of test failures on OS X from 467 to 128 on OS X when -fno-exceptions is enabled, and does not impact the number of failures at all when -fno-exceptions is not enabled. The bulk of this code was donated anonymously. 2013-03-23 17:27:16 +00:00
meta Richard Smith: It was pointed out to me off-list that libc++'s non-compiler-builtin 2013-04-02 21:25:06 +00:00
ratio Fix ratio arithmetic with zero 2011-11-01 23:13:37 +00:00
template.bitset Test case was forming the wrong limits when size_t != unsigned long. 2013-03-29 21:22:22 +00:00
time [tests] One last batch of XFAILs, for tests using new symbols added to libc++. 2013-02-06 00:59:06 +00:00
tuple Give tuple a constexpr default constructor. 2012-07-06 20:39:45 +00:00
type.index Fixing up some ABI issues 2011-07-07 21:03:52 +00:00
utilities.general license change 2010-11-16 22:09:02 +00:00
utility test for pair piecewise construction 2011-06-22 23:51:19 +00:00
utility.requirements license change 2010-11-16 22:09:02 +00:00
nothing_to_do.pass.cpp license change 2010-11-16 22:09:02 +00:00