diff --git a/pkgs/by-name/le/lemon-graph/fix_path_allocator.patch b/pkgs/by-name/le/lemon-graph/fix_path_allocator.patch new file mode 100644 index 000000000000..fef88eae5d14 --- /dev/null +++ b/pkgs/by-name/le/lemon-graph/fix_path_allocator.patch @@ -0,0 +1,68 @@ +diff --git a/lemon/path.h b/lemon/path.h +--- a/lemon/path.h ++++ b/lemon/path.h +@@ -26,6 +26,7 @@ + + #include + #include ++#include + + #include + #include +@@ -448,7 +449,10 @@ namespace lemon { + + Node *first, *last; + +- std::allocator alloc; ++ typedef std::allocator Allocator; ++ typedef std::allocator_traits AllocatorTraits; ++ ++ Allocator alloc; + + public: + +@@ -582,7 +586,7 @@ namespace lemon { + void clear() { + while (first != 0) { + last = first->next; +- alloc.destroy(first); ++ AllocatorTraits::destroy(alloc, first); + alloc.deallocate(first, 1); + first = last; + } +@@ -596,7 +600,7 @@ namespace lemon { + /// \brief Add a new arc before the current path + void addFront(const Arc& arc) { + Node *node = alloc.allocate(1); +- alloc.construct(node, Node()); ++ AllocatorTraits::construct(alloc, node, Node()); + node->prev = 0; + node->next = first; + node->arc = arc; +@@ -617,7 +621,7 @@ namespace lemon { + } else { + last = 0; + } +- alloc.destroy(node); ++ AllocatorTraits::destroy(alloc, node); + alloc.deallocate(node, 1); + } + +@@ -629,7 +633,7 @@ namespace lemon { + /// \brief Add a new arc behind the current path. + void addBack(const Arc& arc) { + Node *node = alloc.allocate(1); +- alloc.construct(node, Node()); ++ AllocatorTraits::construct(alloc, node, Node()); + node->next = 0; + node->prev = last; + node->arc = arc; +@@ -650,7 +654,7 @@ namespace lemon { + } else { + first = 0; + } +- alloc.destroy(node); ++ AllocatorTraits::destroy(alloc, node); + alloc.deallocate(node, 1); + } + diff --git a/pkgs/by-name/le/lemon-graph/package.nix b/pkgs/by-name/le/lemon-graph/package.nix index 0490bbc5187e..58e08d50c58d 100644 --- a/pkgs/by-name/le/lemon-graph/package.nix +++ b/pkgs/by-name/le/lemon-graph/package.nix @@ -30,6 +30,9 @@ stdenv.mkDerivation (finalAttrs: { # fix C++20 compatibility. vendored from https://github.com/The-OpenROAD-Project/lemon-graph/commit/f871b10396270cfd09ffddc4b6ead07722e9c232 ./update_cxx20.patch + + # fix C++20 compatibility of ListPath, submitted to OpenROAD's fork in https://github.com/The-OpenROAD-Project/lemon-graph/pull/5 + ./fix_path_allocator.patch ]; meta = {