external/pdfium/UnpackedTarball_pdfium.mk       |    1 
 external/pdfium/container-stream-concepts.patch |   32 ++++++++++++++++++++++++
 2 files changed, 33 insertions(+)

New commits:
commit 01cf2f8241440e3e66ae8c768eb023b146d7f0d3
Author:     Balazs Varga <[email protected]>
AuthorDate: Fri Feb 27 12:54:59 2026 +0100
Commit:     Miklos Vajna <[email protected]>
CommitDate: Mon Mar 2 14:38:29 2026 +0100

    pdfium: fix build with 7691 by replacing concept-constrained
    
    constructors
    
    Explicit template instantiation of CFX_ReadOnlyContainerStream
    attempts to instantiate all constructor bodies including those whose
    requires constraints are not satisfied, leading to compilation errors. 
Replace the three concept-constrained constructors with a single
    constructor and a static helper using if-constexpr dispatch.
    
    The same issue was here before this revert: 
2f57569c9cda484a141eb81bace67bfe2ae6500c
    (pdfium: downgrade to 7681)
    
    Root cause: pdfium 7691's cfx_read_only_container_stream.h uses three
    C++20 concept-constrained constructors. When explicit template
    instantiation (template class CFX_ReadOnlyContainerStream<T>) is used,
    GCC/Clang attempts to instantiate ALL constructor bodies regardless of
    whether their requires constraints are satisfied. This causes compile
    errors when the wrong constructor body (e.g., data->span() for a
    non-pointer type) gets instantiated.
    
    Fix: Replaced the three concept-constrained constructors with:
    1. A static helper GetSpanFromData() that uses if constexpr to
       dispatch based on the same concepts
    2. A single unconstrained constructor that calls the helper
    3. if constexpr correctly discards the non-matching branches at
       compile time, avoiding the instantiation issue.
    
    Change-Id: I20038f3371e0ae6d450971ada827a633f8d3b6c4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200623
    Reviewed-by: Miklos Vajna <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/external/pdfium/UnpackedTarball_pdfium.mk 
b/external/pdfium/UnpackedTarball_pdfium.mk
index 2f857315ac6e..5864c734b96e 100644
--- a/external/pdfium/UnpackedTarball_pdfium.mk
+++ b/external/pdfium/UnpackedTarball_pdfium.mk
@@ -29,6 +29,7 @@ endif
 # TODO, attempt upstream
 pdfium_patches += ofz451333752.patch
 pdfium_patches += extractpatterns.patch
+pdfium_patches += container-stream-concepts.patch
 
 $(eval $(call gb_UnpackedTarball_UnpackedTarball,pdfium))
 
diff --git a/external/pdfium/container-stream-concepts.patch 
b/external/pdfium/container-stream-concepts.patch
new file mode 100644
index 000000000000..39befd131d67
--- /dev/null
+++ b/external/pdfium/container-stream-concepts.patch
@@ -0,0 +1,32 @@
+--- core/fxcrt/cfx_read_only_container_stream.h        2026-02-27 
12:34:05.172587036 +0100
++++ core/fxcrt/cfx_read_only_container_stream.h        2026-02-27 
12:34:22.968580294 +0100
+@@ -35,19 +35,18 @@
+   CONSTRUCT_VIA_MAKE_RETAIN;
+
+  private:
+-  explicit CFX_ReadOnlyContainerStream(Container data)
+-    requires(HasPtrSpanMethod<Container>)
+-      : CFX_ReadOnlySpanStream(pdfium::as_bytes(data->span())),
+-        data_(std::move(data)) {}
+-
+-  explicit CFX_ReadOnlyContainerStream(Container data)
+-    requires(HasSpanMethod<Container>)
+-      : CFX_ReadOnlySpanStream(pdfium::as_bytes(data.span())),
+-        data_(std::move(data)) {}
++  static pdfium::span<const uint8_t> GetSpanFromData(const Container& data) {
++    if constexpr (HasPtrSpanMethod<Container>) {
++      return pdfium::as_bytes(data->span());
++    } else if constexpr (HasSpanMethod<Container>) {
++      return pdfium::as_bytes(data.span());
++    } else {
++      return pdfium::as_byte_span(data);
++    }
++  }
+
+   explicit CFX_ReadOnlyContainerStream(Container data)
+-    requires(!HasSpanMethod<Container> && !HasPtrSpanMethod<Container>)
+-      : CFX_ReadOnlySpanStream(pdfium::as_byte_span(data)),
++      : CFX_ReadOnlySpanStream(GetSpanFromData(data)),
+         data_(std::move(data)) {}
+
+   ~CFX_ReadOnlyContainerStream() override {

Reply via email to