[libcxx-commits] [libcxx] r360911 - Improve the test coverage for std::is_base_of

Marshall Clow via libcxx-commits libcxx-commits at lists.llvm.org
Thu May 16 08:56:26 PDT 2019


Author: marshall
Date: Thu May 16 08:56:26 2019
New Revision: 360911

URL: http://llvm.org/viewvc/llvm-project?rev=360911&view=rev
Log:
Improve the test coverage for std::is_base_of

Modified:
    libcxx/trunk/test/std/utilities/meta/meta.rel/is_base_of.pass.cpp

Modified: libcxx/trunk/test/std/utilities/meta/meta.rel/is_base_of.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.rel/is_base_of.pass.cpp?rev=360911&r1=360910&r2=360911&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/meta/meta.rel/is_base_of.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/meta/meta.rel/is_base_of.pass.cpp Thu May 16 08:56:26 2019
@@ -39,6 +39,7 @@ struct B {};
 struct B1 : B {};
 struct B2 : B {};
 struct D : private B1, private B2 {};
+struct I0; // incomplete
 
 int main(int, char**)
 {
@@ -54,5 +55,19 @@ int main(int, char**)
     test_is_not_base_of<B[3], D[3]>();
     test_is_not_base_of<int, int>();
 
+//  A scalar is never the base class of anything (including incomplete types)
+    test_is_not_base_of<int, B>();
+    test_is_not_base_of<int, B1>();
+    test_is_not_base_of<int, B2>();
+    test_is_not_base_of<int, D>();
+    test_is_not_base_of<int, I0>();
+
+//  A scalar never has base classes (including incomplete types)
+    test_is_not_base_of<B,  int>();
+    test_is_not_base_of<B1, int>();
+    test_is_not_base_of<B2, int>();
+    test_is_not_base_of<D,  int>();
+    test_is_not_base_of<I0, int>();
+
   return 0;
 }




More information about the libcxx-commits mailing list