1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 08:28:11 +00:00

AK: Add SFINAE fallback for AK C++ concepts use, for Coverity compiler

The Coverity compiler doesn't support C++2a yet, and thus doesn't
even recognize concept keywords. To allow serenity to be built and
analyzed on such compilers, add a fallback underdef to perform
the same template restriction based on AK::EnableIf<..> meta
programming.

Note: Coverity does seem to (annoyingly) define __cpp_concepts, even
though it doesn't support them, so we need to further check for
__COVERITY__ explicitly.
This commit is contained in:
Brian Gianforcaro 2020-08-16 15:11:05 -07:00 committed by Andreas Kling
parent 2030a49a1e
commit ff0c7da75d
3 changed files with 17 additions and 3 deletions

View file

@ -30,10 +30,14 @@
namespace AK::Concepts {
#if defined(__cpp_concepts) && !defined(__COVERITY__)
template<typename T>
concept Integral = IsIntegral<T>::value;
template<typename T>
concept FloatingPoint = IsFloatingPoint<T>::value;
#endif
}