fix(Any): nullptr_t usage #4465

This commit is contained in:
Alex Fabijanic 2024-02-19 10:52:33 +01:00
parent 88be66972a
commit 8460105d5a
2 changed files with 7 additions and 7 deletions

View File

@ -170,7 +170,7 @@ protected:
#define poco_static_assert_ptr(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_function_pointer_v<T> || \
std::is_member_object_pointer_v<T>, \

View File

@ -360,17 +360,17 @@ void AnyTest::testAnyPointer()
assertTrue (*cpyI == *p);
std::string* s = AnyCast<std::string>(&a);
assertTrue (s == NULL);
assertTrue (AnyCast<nullptr_t>(&a) == nullptr);
assertTrue (AnyCast<std::nullptr_t>(&a) == nullptr);
int* POCO_UNUSED tmp = AnyCast<int*>(a);
const Any c = a;
tmp = AnyCast<int*>(a);
Any nullPtr(nullptr);
assertFalse (AnyHoldsNullPtr<nullptr_t>(nullptr));
assertFalse (AnyHoldsNullPtr<std::nullptr_t>(nullptr));
assertFalse (AnyHoldsNullPtr<void*>(0));
assertTrue (AnyHoldsNullPtr<nullptr_t>(nullPtr));
assertTrue (AnyHoldsNullPtr<nullptr_t>(&nullPtr));
assertTrue (AnyHoldsNullPtr<std::nullptr_t>(nullPtr));
assertTrue (AnyHoldsNullPtr<std::nullptr_t>(&nullPtr));
try
{
AnyHoldsNullPtr<void*>(nullPtr);
@ -380,7 +380,7 @@ void AnyTest::testAnyPointer()
nullPtr = &i;
try
{
assertFalse (AnyHoldsNullPtr<nullptr_t>(nullPtr));
assertFalse (AnyHoldsNullPtr<std::nullptr_t>(nullPtr));
fail ("AnyCast must fail", __LINE__, __FILE__);
}
catch(const Poco::BadCastException&) {}
@ -391,7 +391,7 @@ void AnyTest::testAnyPointer()
assertTrue (AnyHoldsNullPtr<void*>(nullVoidPtr));
try
{
AnyHoldsNullPtr<nullptr_t>(voidPtr);
AnyHoldsNullPtr<std::nullptr_t>(voidPtr);
fail ("AnyCast must fail", __LINE__, __FILE__);
}
catch(const Poco::BadCastException&) {}