Files
loongoffice/external/pdfium/c++20-comparison.patch
Stephan Bergmann 6e0461d576 external/pdfium: C++20 comparison operator fix
Missing const leads to overload resolution ambiguity when a synthesized
candidate of operator == for a reversed-argument rewrite conflicts with the
actual operator ==, due to the asymmetric const-ness of the implicit object
parameter and the RHS parameter:

> In file included from workdir/UnpackedTarball/pdfium/core/fxge/cfx_font.cpp:7:
> In file included from workdir/UnpackedTarball/pdfium/core/fxge/cfx_font.h:11:
> llvm/inst/include/c++/v1/vector:1369:27: error: use of overloaded operator '!=' is ambiguous (with operand types 'std::__1::__vector_base<unsigned char, FxAllocAllocator<unsigned char> >::allocator_type' (aka 'FxAllocAllocator<unsigned char>') and 'std::__1::__vector_base<unsigned char, FxAllocAllocator<unsigned char> >::allocator_type')
>     if (__base::__alloc() != __c.__alloc())
>         ~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~
> llvm/inst/include/c++/v1/vector:1359:5: note: in instantiation of member function 'std::__1::vector<unsigned char, FxAllocAllocator<unsigned char> >::__move_assign' requested here
>     __move_assign(__x, integral_constant<bool,
>     ^
> workdir/UnpackedTarball/pdfium/core/fxge/cfx_font.cpp:384:24: note: in instantiation of member function 'std::__1::vector<unsigned char, FxAllocAllocator<unsigned char> >::operator=' requested here
>   m_FontDataAllocation = std::vector<uint8_t, FxAllocAllocator<uint8_t>>(
>                        ^
> workdir/UnpackedTarball/pdfium/core/fxcrt/fx_memory_wrappers.h:74:8: note: candidate function
>   bool operator!=(const FxAllocAllocator& that) { return false; }
>        ^
> workdir/UnpackedTarball/pdfium/core/fxcrt/fx_memory_wrappers.h:73:8: note: candidate function
>   bool operator==(const FxAllocAllocator& that) { return true; }
>        ^
> workdir/UnpackedTarball/pdfium/core/fxcrt/fx_memory_wrappers.h:73:8: note: candidate function (with reversed parameter order)

Change-Id: I48cfc8ce37287d9d3c0dec8c4d8b14b53de895d9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86993
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-01-18 10:06:16 +01:00

14 lines
476 B
Diff

--- core/fxcrt/fx_memory_wrappers.h
+++ core/fxcrt/fx_memory_wrappers.h
@@ -70,8 +70,8 @@
}
// There's no state, so they are all the same,
- bool operator==(const FxAllocAllocator& that) { return true; }
- bool operator!=(const FxAllocAllocator& that) { return false; }
+ bool operator==(const FxAllocAllocator& that) const { return true; }
+ bool operator!=(const FxAllocAllocator& that) const { return false; }
};
#endif // CORE_FXCRT_FX_MEMORY_WRAPPERS_H_