[ADT][NFC] Fix compilation of headers under C++23
`DoubleAPFloat` has a `unique_ptr<APFloat[]>` member. In `DoubleAPFloat::operator=` and `DoubleAPFloat::get{First,Second}`, the methods of this unique_ptr are getting instantiated. At that point `APFloat` is still only a forward declaration. This triggers undefined behavior. So far, we were probaly just lucky and the code compiled fine. However, with C++23 `std::unique_ptr` became constexpr, and clang (and other compilers) are now diagnosing this latent bug as an error. This commit fixes the issue by moving the function definitions out of the class definition of `DoubleAPFloat`, after the declaration of `APFloat`. A similar issue exists in `ModuleSummaryIndex.h`, the fix is pretty much identical. Fixes #59784 Differential Revision: https://reviews.llvm.org/D149854
Loading
Please sign in to comment