From 379115a20e2c57460324f0ba6a493bf76c3af908 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 9 Mar 2020 18:03:13 +0100 Subject: Fix MacOS 10.11 (clang-8.0.0) builds gcc, and recent clang-10 can construct new objects using references as arguments. However clang-8 (and MSVC?) do not: "error: no matching function for call to 'operator new'" The compiler apparently does not expand the template class A <-> `A*` vs. `A const&` for different cases. --- libs/pbd/pbd/stack_allocator.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'libs/pbd') diff --git a/libs/pbd/pbd/stack_allocator.h b/libs/pbd/pbd/stack_allocator.h index d719b5c5f3..9eed081ec0 100644 --- a/libs/pbd/pbd/stack_allocator.h +++ b/libs/pbd/pbd/stack_allocator.h @@ -128,17 +128,19 @@ public: new (p) U (); } +#if __cplusplus > 201103L || defined __clang__ template - void construct (U* const p, A& a) + void construct (U* const p, A* const a) { new (p) U (a); } - - template - void construct (U* const p, A& a, B& b) +#else + template + void construct (U* const p, A const& a) { - new (p) U (a, b); + new (p) U (a); } +#endif private: StackAllocator& operator= (const StackAllocator&); -- cgit v1.2.3