LibGC: Make GC::Root bool operator explicit

Not having this led to a sneaky bug where, given a Variant like so:

  Variant<double, GC::Root<T>>

An incorrectly-written visit() branch for the Root would just cause it
to be cast to a double and call that branch instead.

With the cast made explicit, we get a compiler error, which is far more
useful.

Co-authored-by: Jelle Raaijmakers <jelle@ladybird.org>
This commit is contained in:
Sam Atkins
2025-08-21 12:31:17 +01:00
committed by Tim Flynn
parent ce03b8b3b1
commit 8af99388a6
Notes: github-actions[bot] 2025-08-21 16:51:47 +00:00

View File

@@ -105,7 +105,7 @@ public:
{
return !cell();
}
operator bool() const
explicit operator bool() const
{
return cell();
}