Skip to content
Snippets Groups Projects
Unverified Commit 2835bd76 authored by Jonathan Wakely's avatar Jonathan Wakely Committed by Jonathan Wakely
Browse files

libstdc++: Remove constraints on std::generator::promise_type::operator new


This was approved in Wrocław as LWG 3900, so that passing an incorrect
argument intended as an allocator will be ill-formed, instead of
silently ignored.

This also renames the template parameters and function parameters for
the allocators, to align with the names in the standard. I found it too
confusing to have a parameter _Alloc which doesn't correspond to Alloc
in the standard. Rename _Alloc to _Allocator (which the standard calls
Allocator) and rename _Na to _Alloc (which the standard calls Alloc).

libstdc++-v3/ChangeLog:

	* include/std/generator (_Promise_alloc): Rename template
	parameter. Use __alloc_rebind to rebind allocator.
	(_Promise_alloc::operator new): Replace constraints with a
	static_assert in the body. Rename allocator parameter.
	(_Promise_alloc<void>::_M_allocate): Rename allocator parameter.
	Use __alloc_rebind to rebind allocator.
	(_Promise_alloc<void>::operator new): Rename allocator
	parameter.
	* testsuite/24_iterators/range_generators/alloc.cc: New test.
	* testsuite/24_iterators/range_generators/lwg3900.cc: New test.

Reviewed-by: default avatarArsen Arsenović <arsen@aarsen.me>
parent fca0ab08
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment