summaryrefslogtreecommitdiff
path: root/libs/pbd
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2020-03-09 18:03:13 +0100
committerRobin Gareus <robin@gareus.org>2020-03-09 18:33:11 +0100
commit379115a20e2c57460324f0ba6a493bf76c3af908 (patch)
tree413b571df30dd53ba4bd15d07618768c91e2020e /libs/pbd
parent70e2ddbc1b006680e40127ff4a92df7cba17cb3c (diff)
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.
Diffstat (limited to 'libs/pbd')
-rw-r--r--libs/pbd/pbd/stack_allocator.h12
1 files changed, 7 insertions, 5 deletions
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 <class U, class A>
- void construct (U* const p, A& a)
+ void construct (U* const p, A* const a)
{
new (p) U (a);
}
-
- template <class U, class A, class B>
- void construct (U* const p, A& a, B& b)
+#else
+ template <class U, class A>
+ void construct (U* const p, A const& a)
{
- new (p) U (a, b);
+ new (p) U (a);
}
+#endif
private:
StackAllocator& operator= (const StackAllocator&);