mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-29 06:02:07 +03:00
AK: Prevent Atomic with complex types
This would throw some really weird linker errors, so let's prevent it from happening instead!
This commit is contained in:
parent
d905de6a7a
commit
7418bdb85f
Notes:
sideshowbarker
2024-07-17 18:22:48 +09:00
Author: https://github.com/kleinesfilmroellchen Commit: https://github.com/SerenityOS/serenity/commit/7418bdb85f Pull-request: https://github.com/SerenityOS/serenity/pull/12732 Reviewed-by: https://github.com/linusg
@ -138,6 +138,10 @@ static inline bool atomic_is_lock_free(volatile T* ptr = nullptr) noexcept
|
||||
|
||||
template<typename T, MemoryOrder DefaultMemoryOrder = AK::MemoryOrder::memory_order_seq_cst>
|
||||
class Atomic {
|
||||
// FIXME: This should work through concepts/requires clauses, but according to the compiler,
|
||||
// "IsIntegral is not more specialized than IsFundamental".
|
||||
// Additionally, Enums are not fundamental types except that they behave like them in every observable way.
|
||||
static_assert(IsFundamental<T> | IsEnum<T>, "Atomic doesn't support non-primitive types, because it relies on compiler intrinsics. If you put non-primitives into it, you'll get linker errors like \"undefined reference to __atomic_store\".");
|
||||
T m_value { 0 };
|
||||
|
||||
public:
|
||||
|
Loading…
Reference in New Issue
Block a user