COMP: disambiguate pTraits for long/unsigned long on Darwin

This commit is contained in:
Mark Olesen 2025-03-25 15:44:22 +01:00
parent 707db0b65b
commit bdb890d4e2
5 changed files with 14 additions and 3 deletions

View File

@ -1,2 +1,3 @@
Test-pTraits.C
Test-pTraits.cxx
EXE = $(FOAM_USER_APPBIN)/Test-pTraits

View File

@ -126,7 +126,7 @@ Ostream& operator<<(Ostream& os, const int64_t val);
// On Darwin:
// long is not unambiguously (int32_t | int64_t)
// - explicitly resolve for input and output
#if defined(__APPLE__)
#ifdef __APPLE__
Istream& operator>>(Istream& is, long& val);
Ostream& operator<<(Ostream& os, const long val);
#endif
@ -196,6 +196,11 @@ public:
};
#ifdef __APPLE__
//- On Darwin: long is not unambiguously (int64_t)
template<> class pTraits<long> : pTraits<int64_t> {};
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -182,7 +182,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const int64_t val)
}
#if defined(__APPLE__)
#ifdef __APPLE__
Foam::Istream& Foam::operator>>(Istream& is, long& val)
{
return operator>>(is, reinterpret_cast<int64_t&>(val));

View File

@ -186,6 +186,11 @@ public:
};
#ifdef __APPLE__
//- On Darwin: unsigned long is not unambiguously (uint64_t)
template<> class pTraits<unsigned long> : pTraits<uint64_t> {};
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam