diff options
author | Marshall Clow <mclow.lists@gmail.com> | 2016-10-05 17:01:16 +0000 |
---|---|---|
committer | Marshall Clow <mclow.lists@gmail.com> | 2016-10-05 17:01:16 +0000 |
commit | d836a9d5f1e527eb7ad0d6856527fed15e7a1f5a (patch) | |
tree | bd9702de1bfe6e77390ac3ca20b8527007689343 /libcxx/test | |
parent | b530f1649e4c6d9aca82511877f42b9ed55fb172 (diff) | |
download | bcm5719-llvm-d836a9d5f1e527eb7ad0d6856527fed15e7a1f5a.tar.gz bcm5719-llvm-d836a9d5f1e527eb7ad0d6856527fed15e7a1f5a.zip |
Make tests for is_empty better. No functional change.
llvm-svn: 283339
Diffstat (limited to 'libcxx/test')
-rw-r--r-- | libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp index 410c1db7244..c1cbccba04b 100644 --- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp @@ -11,6 +11,14 @@ // is_empty +// T is a non-union class type with: +// no non-static data members, +// no unnamed bit-fields of non-zero length, +// no virtual member functions, +// no virtual base classes, +// and no base class B for which is_empty_v<B> is false. + + #include <type_traits> #include "test_macros.h" @@ -44,22 +52,33 @@ void test_is_not_empty() #endif } -class Empty -{ -}; +class Empty {}; +struct NotEmpty { int foo; }; -class NotEmpty +class VirtualFn { - virtual ~NotEmpty(); + virtual ~VirtualFn(); }; union Union {}; +struct EmptyBase : public Empty {}; +struct VirtualBase : virtual Empty {}; +struct NotEmptyBase : public NotEmpty {}; + +struct StaticMember { static int foo; }; +struct NonStaticMember { int foo; }; + struct bit_zero { int : 0; }; +struct bit_one +{ + int : 1; +}; + int main() { test_is_not_empty<void>(); @@ -72,7 +91,14 @@ int main() test_is_not_empty<char[]>(); test_is_not_empty<Union>(); test_is_not_empty<NotEmpty>(); + test_is_not_empty<VirtualFn>(); + test_is_not_empty<VirtualBase>(); + test_is_not_empty<NotEmptyBase>(); + test_is_not_empty<NonStaticMember>(); + test_is_empty<bit_one>(); test_is_empty<Empty>(); + test_is_empty<EmptyBase>(); + test_is_empty<StaticMember>(); test_is_empty<bit_zero>(); } |