Skip to content

Commit f1cac5b

Browse files
committed
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 d77bc02)
1 parent f43cb10 commit f1cac5b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/pasteboard-generic.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,15 @@
2626

2727
#include "pasteboard-private.h"
2828

29-
#include "alloc-private.h"
30-
#include <cstdlib>
31-
#include <cstring>
3229
#include <map>
3330
#include <string>
3431

32+
// We need to include this header last, in order to avoid template expansions
33+
// from the C++ standard library happening after it forbids usage of the libc
34+
// memory functions.
35+
#include "alloc-private.h"
36+
#include <cstring>
37+
3538
namespace Generic {
3639
using Pasteboard = std::map<std::string, std::string>;
3740
}

0 commit comments

Comments
 (0)