AK: Fix ambiguity in AK::Optional specialization

The specialization for the destructor of `AK::Optional` is ambiguous
when `T` is neither TriviallyDestructible nor Destructible.
The fix adds an additional check for `Destructible` when generating the
destructor of `AK::Optional`, since it calls the destructor of `T`, and
therefore already required `T` to be `Destructible` anyway.
This commit is contained in:
Jonne Ransijn 2024-10-22 16:47:01 +02:00 committed by Andreas Kling
parent e76064e67f
commit e636f3976d
Notes: github-actions[bot] 2024-10-27 12:27:25 +00:00

View file

@ -171,7 +171,7 @@ public:
}
ALWAYS_INLINE ~Optional()
requires(!IsTriviallyDestructible<T>)
requires(!IsTriviallyDestructible<T> && IsDestructible<T>)
{
clear();
}