Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Behaviour of std::pmr::memory_resource::do_allocate() is ambiguous #966

Closed
iolojz opened this issue Nov 4, 2016 · 2 comments
Closed

Behaviour of std::pmr::memory_resource::do_allocate() is ambiguous #966

iolojz opened this issue Nov 4, 2016 · 2 comments
Assignees
Labels
lwg Issue must be reviewed by LWG.

Comments

@iolojz
Copy link

iolojz commented Nov 4, 2016

essentially a copy of this StackOverflow question.

To quote N4606:

virtual void* do_allocate(size_t bytes, size_t alignment) = 0;

Requires: Alignment shall be a power of two.

Returns: A derived class shall implement this function to return a pointer to allocated storage (3.7.4.2) with a size of at least bytes. The returned storage is aligned to the specified alignment, if such alignment is supported; otherwise it is aligned to max_align.

Throws: A derived class implementation shall throw an appropriate exception if it is unable to allocate memory with the requested size and alignment.

This is ambiguous: What happens if the alignment is a power of two but unsupported (e.g larger than max_align)? Is the returned storage aligned to max_align or is an exception thrown?

@jensmaurer jensmaurer self-assigned this Dec 13, 2016
@jensmaurer
Copy link
Member

I've asked for an LWG issue.

@jensmaurer jensmaurer added the lwg Issue must be reviewed by LWG. label Dec 13, 2016
@jensmaurer
Copy link
Member

LWG 2843

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lwg Issue must be reviewed by LWG.
Projects
None yet
Development

No branches or pull requests

2 participants