michael@0: diff --git a/mfbt/double-conversion/utils.h b/mfbt/double-conversion/utils.h michael@0: --- a/mfbt/double-conversion/utils.h michael@0: +++ b/mfbt/double-conversion/utils.h michael@0: @@ -275,19 +275,18 @@ class StringBuilder { michael@0: // There is an additional use for BitCast. michael@0: // Recent gccs will warn when they see casts that may result in breakage due to michael@0: // the type-based aliasing rule. If you have checked that there is no breakage michael@0: // you can use BitCast to cast one pointer type to another. This confuses gcc michael@0: // enough that it can no longer see that you have cast one pointer type to michael@0: // another thus avoiding the warning. michael@0: template michael@0: inline Dest BitCast(const Source& source) { michael@0: - // Compile time assertion: sizeof(Dest) == sizeof(Source) michael@0: - // A compile error here means your Dest and Source have different sizes. michael@0: - typedef char VerifySizesAreEqual[sizeof(Dest) == sizeof(Source) ? 1 : -1]; michael@0: + static_assert(sizeof(Dest) == sizeof(Source), michael@0: + "BitCast's source and destination types must be the same size"); michael@0: michael@0: Dest dest; michael@0: memmove(&dest, &source, sizeof(dest)); michael@0: return dest; michael@0: } michael@0: michael@0: template michael@0: inline Dest BitCast(Source* source) {