diff --git a/llvm/include/llvm/ADT/APFloat.h b/llvm/include/llvm/ADT/APFloat.h index 97547fb577e0e..436052d8aa265 100644 --- a/llvm/include/llvm/ADT/APFloat.h +++ b/llvm/include/llvm/ADT/APFloat.h @@ -1474,11 +1474,11 @@ class APFloat : public APFloatBase { friend APFloat frexp(const APFloat &X, int &Exp, roundingMode RM); friend IEEEFloat; friend DoubleAPFloat; + // Since Storage is private, friend class APFloatEBOChecker is added to allow + // access to it in APFloat.cpp. + friend class APFloatEBOChecker; }; -static_assert(sizeof(APFloat) == sizeof(detail::IEEEFloat), - "Empty base class optimization is not performed."); - /// See friend declarations above. /// /// These additional declarations are required in order to compile LLVM with IBM diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp index a33b6c4a6ddc6..f48c82b6afdd8 100644 --- a/llvm/lib/Support/APFloat.cpp +++ b/llvm/lib/Support/APFloat.cpp @@ -99,6 +99,11 @@ enum class fltNanEncoding { NegativeZero, }; +class APFloatEBOChecker { + static_assert(sizeof(APFloat) == sizeof(APFloat::U), + "Empty base class optimization is not performed."); +}; + /* Represents floating point arithmetic semantics. */ struct fltSemantics { /* The largest E such that 2^E is representable; this matches the