object_allocator only allowed allocations to use the default constructor.
This patch generalises it to other constructors, in the same way as
rtl-ssa does for obstack allocations.
The first use case is likely to be Robin's backprop patch.
gcc/
* alloc-pool.h (object_allocator::allocate): Generalize to handle
non-default constructors.
/* Allocate memory for instance of type T and call a default constructor. */
- inline T *
- allocate () ATTRIBUTE_MALLOC
+ template<typename... Ts>
+ inline ATTRIBUTE_MALLOC T *
+ allocate (Ts... args)
{
- return ::new (m_allocator.allocate ()) T;
+ return ::new (m_allocator.allocate ()) T (std::forward<Ts> (args)...);
}
/* Allocate memory for instance of type T and return void * that