diff --git a/AK/Concepts.h b/AK/Concepts.h index cb78982f0c..b49c5790cc 100644 --- a/AK/Concepts.h +++ b/AK/Concepts.h @@ -30,10 +30,14 @@ namespace AK::Concepts { +#if defined(__cpp_concepts) && !defined(__COVERITY__) + template concept Integral = IsIntegral::value; template concept FloatingPoint = IsFloatingPoint::value; +#endif + } diff --git a/AK/Stream.h b/AK/Stream.h index b946e90d05..ff6d32d979 100644 --- a/AK/Stream.h +++ b/AK/Stream.h @@ -62,7 +62,11 @@ public: virtual bool discard_or_error(size_t count) = 0; }; +#if defined(__cpp_concepts) && !defined(__COVERITY__) template +#else +template::value, int>::Type = 0> +#endif InputStream& operator>>(InputStream& stream, Integral& value) { stream.read_or_error({ &value, sizeof(value) }); @@ -70,12 +74,18 @@ InputStream& operator>>(InputStream& stream, Integral& value) } #ifndef KERNEL + +#if defined(__cpp_concepts) && !defined(__COVERITY__) template +#else +template::value, int>::Type = 0> +#endif InputStream& operator>>(InputStream& stream, FloatingPoint& value) { stream.read_or_error({ &value, sizeof(value) }); return stream; } + #endif inline InputStream& operator>>(InputStream& stream, bool& value) diff --git a/AK/Userspace.h b/AK/Userspace.h index 8c8b778c13..d7586b7ef7 100644 --- a/AK/Userspace.h +++ b/AK/Userspace.h @@ -33,12 +33,12 @@ namespace AK { // HACK: This is just here to make syntax highlighting work in Qt Creator. // Once it supports C++20 concepts, we can remove this. -#ifdef __clang__ -template -#else +#if defined(__cpp_concepts) && !defined(__COVERITY__) template concept PointerTypeName = IsPointer::value; template +#else +template::value, int>::Type = 0> #endif class Userspace {