mirror of
https://github.com/pocoproject/poco.git
synced 2025-01-19 08:46:41 +01:00
fix(Any): nullptr_t usage #4465
This commit is contained in:
parent
88be66972a
commit
8460105d5a
@ -170,7 +170,7 @@ protected:
|
|||||||
|
|
||||||
#define poco_static_assert_ptr(T) \
|
#define poco_static_assert_ptr(T) \
|
||||||
static_assert(std::is_pointer_v<T> || \
|
static_assert(std::is_pointer_v<T> || \
|
||||||
std::is_same_v<T, nullptr_t> || \
|
std::is_same_v<T, std::nullptr_t> || \
|
||||||
std::is_member_pointer_v<T> || \
|
std::is_member_pointer_v<T> || \
|
||||||
std::is_member_function_pointer_v<T> || \
|
std::is_member_function_pointer_v<T> || \
|
||||||
std::is_member_object_pointer_v<T>, \
|
std::is_member_object_pointer_v<T>, \
|
||||||
|
@ -360,17 +360,17 @@ void AnyTest::testAnyPointer()
|
|||||||
assertTrue (*cpyI == *p);
|
assertTrue (*cpyI == *p);
|
||||||
std::string* s = AnyCast<std::string>(&a);
|
std::string* s = AnyCast<std::string>(&a);
|
||||||
assertTrue (s == NULL);
|
assertTrue (s == NULL);
|
||||||
assertTrue (AnyCast<nullptr_t>(&a) == nullptr);
|
assertTrue (AnyCast<std::nullptr_t>(&a) == nullptr);
|
||||||
|
|
||||||
int* POCO_UNUSED tmp = AnyCast<int*>(a);
|
int* POCO_UNUSED tmp = AnyCast<int*>(a);
|
||||||
const Any c = a;
|
const Any c = a;
|
||||||
tmp = AnyCast<int*>(a);
|
tmp = AnyCast<int*>(a);
|
||||||
|
|
||||||
Any nullPtr(nullptr);
|
Any nullPtr(nullptr);
|
||||||
assertFalse (AnyHoldsNullPtr<nullptr_t>(nullptr));
|
assertFalse (AnyHoldsNullPtr<std::nullptr_t>(nullptr));
|
||||||
assertFalse (AnyHoldsNullPtr<void*>(0));
|
assertFalse (AnyHoldsNullPtr<void*>(0));
|
||||||
assertTrue (AnyHoldsNullPtr<nullptr_t>(nullPtr));
|
assertTrue (AnyHoldsNullPtr<std::nullptr_t>(nullPtr));
|
||||||
assertTrue (AnyHoldsNullPtr<nullptr_t>(&nullPtr));
|
assertTrue (AnyHoldsNullPtr<std::nullptr_t>(&nullPtr));
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
AnyHoldsNullPtr<void*>(nullPtr);
|
AnyHoldsNullPtr<void*>(nullPtr);
|
||||||
@ -380,7 +380,7 @@ void AnyTest::testAnyPointer()
|
|||||||
nullPtr = &i;
|
nullPtr = &i;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
assertFalse (AnyHoldsNullPtr<nullptr_t>(nullPtr));
|
assertFalse (AnyHoldsNullPtr<std::nullptr_t>(nullPtr));
|
||||||
fail ("AnyCast must fail", __LINE__, __FILE__);
|
fail ("AnyCast must fail", __LINE__, __FILE__);
|
||||||
}
|
}
|
||||||
catch(const Poco::BadCastException&) {}
|
catch(const Poco::BadCastException&) {}
|
||||||
@ -391,7 +391,7 @@ void AnyTest::testAnyPointer()
|
|||||||
assertTrue (AnyHoldsNullPtr<void*>(nullVoidPtr));
|
assertTrue (AnyHoldsNullPtr<void*>(nullVoidPtr));
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
AnyHoldsNullPtr<nullptr_t>(voidPtr);
|
AnyHoldsNullPtr<std::nullptr_t>(voidPtr);
|
||||||
fail ("AnyCast must fail", __LINE__, __FILE__);
|
fail ("AnyCast must fail", __LINE__, __FILE__);
|
||||||
}
|
}
|
||||||
catch(const Poco::BadCastException&) {}
|
catch(const Poco::BadCastException&) {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user