mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-22 16:37:40 +08:00
Improve the test coverage for std::is_base_of
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@360911 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -39,6 +39,7 @@ struct B {};
|
|||||||
struct B1 : B {};
|
struct B1 : B {};
|
||||||
struct B2 : B {};
|
struct B2 : B {};
|
||||||
struct D : private B1, private B2 {};
|
struct D : private B1, private B2 {};
|
||||||
|
struct I0; // incomplete
|
||||||
|
|
||||||
int main(int, char**)
|
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<B[3], D[3]>();
|
||||||
test_is_not_base_of<int, int>();
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user