Bug 1508460: Add specialization for void* to HasFreeLSB; r=froydnj
authorAaron Klotz <aklotz@mozilla.com>
Mon, 19 Nov 2018 23:56:54 +0000
changeset 506281 853889cec3ab4718caf3d291bce3374f1f54ce96
parent 506280 d1d8e236cf158b5fc75a97d6f3a0ed76cc341ebc
child 506282 bc720a5a993c624de10dd325d69f71334d1670d6
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1508460
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1508460: Add specialization for void* to HasFreeLSB; r=froydnj HasFreeLSB currently fails for any types that map to void*. Unless we fix this, we can't use certain types as template parameters for mozilla::Result. Differential Revision: https://phabricator.services.mozilla.com/D12358
mfbt/Result.h
--- a/mfbt/Result.h
+++ b/mfbt/Result.h
@@ -216,16 +216,21 @@ struct UnusedZero<T&>
   static const bool value = true;
 };
 
 // A bit of help figuring out which of the above specializations to use.
 //
 // We begin by safely assuming types don't have a spare bit.
 template <typename T> struct HasFreeLSB { static const bool value = false; };
 
+// As an incomplete type, void* does not have a spare bit.
+template <> struct HasFreeLSB<void*> {
+  static const bool value = false;
+};
+
 // The lowest bit of a properly-aligned pointer is always zero if the pointee
 // type is greater than byte-aligned. That bit is free to use if it's masked
 // out of such pointers before they're dereferenced.
 template <typename T> struct HasFreeLSB<T*> {
   static const bool value = (alignof(T) & 1) == 0;
 };
 
 // We store references as pointers, so they have a free bit if a pointer would