mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-04 15:45:25 +00:00
AK: Rename the const overload of FixedMemoryStream::bytes()
Due to overload resolutions rules, this simple code provokes a crash:
ReadonlyBytes readonly_bytes{};
FixedMemoryStream stream{readonly_bytes};
ReadonlyBytes give_them_back{stream.bytes()};
// -> Panics on VERIFY(m_writing_enabled);
// but this is fine:
auto bytes = static_cast<FixedMemoryStream const&>(*stream).bytes()
If we need to be explicit about it, let's rename the overload instead of
adding that `static_cast`.
This commit is contained in:
committed by
Sam Atkins
parent
66c9696687
commit
18b7ddd0b5
@@ -114,7 +114,7 @@ Bytes FixedMemoryStream::bytes()
|
||||
VERIFY(m_writing_enabled);
|
||||
return m_bytes;
|
||||
}
|
||||
ReadonlyBytes FixedMemoryStream::bytes() const
|
||||
ReadonlyBytes FixedMemoryStream::readonly_bytes() const
|
||||
{
|
||||
return m_bytes;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user