Opened 7 years ago

Last modified 7 years ago

#11414 new Bugs

minor problem in libs/pool/example/sys_allocator.hpp

Reported by: Ed Vogel <edward.vogel@…> Owned by: Chris Newbold
Milestone: To Be Determined Component: pool
Version: Boost 1.57.0 Severity: Problem
Keywords: Cc:

Description

In sys_allocator.hpp the struct new_delete_allocator has a minor issue.

The code is:

static pointer allocate(const size_type n, const void* = 0) { return (pointer) new char[n * sizeof(T)]; } static void deallocate(const pointer p, const size_type) { delete [] p; }

Note that the deallocate member function calls array delete, but the allocate function does not call array new. According to the standard this is invalid.

The HP NonStop runtime will generate an assert failure on the call to the delete.

Change History (1)

comment:1 by viboes, 7 years ago

Component: Nonepool
Owner: set to Chris Newbold
Note: See TracTickets for help on using tickets.