With never versions of libc++, Chromium builds would fail with:
../../third_party/nearby/src/connections/payload.cc:105:50:
error: returning reference to local temporary object [-Werror,-Wreturn-stack-address]
return result ? std::move(*result) : std::move(ByteArray());
^~~~~~~~~~~
Before this libc++ version, the error was masked by the std::move.
If I understand correctly, the only user of this function was
BytesInternalPayload::DetachNextChunk() which was going to make a copy of the
ByteArray annyways, so it might as well use the AsBytes() overload that returns
a const ref.
See also https://crbug.com/1407615#c2
PiperOrigin-RevId: 502946204