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.
This commit is contained in:
parent
70e2ddbc1b
commit
379115a20e
@ -128,17 +128,19 @@ public:
|
|||||||
new (p) U ();
|
new (p) U ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if __cplusplus > 201103L || defined __clang__
|
||||||
template <class U, class A>
|
template <class U, class A>
|
||||||
void construct (U* const p, A& a)
|
void construct (U* const p, A* const a)
|
||||||
{
|
{
|
||||||
new (p) U (a);
|
new (p) U (a);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
template <class U, class A, class B>
|
template <class U, class A>
|
||||||
void construct (U* const p, A& a, B& b)
|
void construct (U* const p, A const& a)
|
||||||
{
|
{
|
||||||
new (p) U (a, b);
|
new (p) U (a);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
StackAllocator& operator= (const StackAllocator&);
|
StackAllocator& operator= (const StackAllocator&);
|
||||||
|
Loading…
Reference in New Issue
Block a user