From f1cac5b25c7698b09a8c3c734cb4ee37619f4183 Mon Sep 17 00:00:00 2001 From: Adrian Perez de Castro Date: Thu, 4 Aug 2022 12:19:05 +0300 Subject: [PATCH] Fix build failure due to libc++ using libc functions Include the "alloc-private.h" header after the C++ standard library headers. This sidesteps build failures caused by implementations of std::map and std::string which use libc memory allocation functions in expanded templates after they have been marked with the "poison" pragma. Fixes #115 (cherry picked from commit d77bc02f6b0031a8ee93750b796259fb095054fe) --- src/pasteboard-generic.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/pasteboard-generic.cpp b/src/pasteboard-generic.cpp index 86fe4ee5..a357027e 100644 --- a/src/pasteboard-generic.cpp +++ b/src/pasteboard-generic.cpp @@ -26,12 +26,15 @@ #include "pasteboard-private.h" -#include "alloc-private.h" -#include -#include #include #include +// We need to include this header last, in order to avoid template expansions +// from the C++ standard library happening after it forbids usage of the libc +// memory functions. +#include "alloc-private.h" +#include + namespace Generic { using Pasteboard = std::map; }