This is an archive of the discontinued LLVM Phabricator instance.

Test that correct value category is used in scoped_allocator_adaptor::construct
ClosedPublic

Authored by zoecarver on Jun 8 2019, 10:26 AM.

Details

Summary

This patch fixes 2586. Just tests; NFC.

Diff Detail

Event Timeline

zoecarver created this revision.Jun 8 2019, 10:26 AM

For the pair section of the issue, I ran into a few problems. The genesis of the problem is the fact that this compiles (and I can't figure out why):

struct Foo
{
	typedef std::allocator<Foo> allocator_type;
	
	Foo(std::allocator_arg_t, allocator_type&&) { }
	Foo(allocator_type&) { }
};

int main()
{
	using Alloc1 = std::allocator<pair<Foo, Foo>>;
	using Alloc2 = std::allocator<Foo>;
	static_assert( std::is_constructible<Foo, std::allocator_arg_t, Alloc1&>::value);
	static_assert(!std::is_constructible<Foo, std::allocator_arg_t, Alloc2&>::value);
}

It doesn't compile because Alloc1 is convertible to Alloc2, and when it makes the conversion it can turn into either value category (thanks to Eric for explaining). Anyhow, given that bit of information I do not see how the pair portion of this issue can be tested (or how the change matters for pairs).

zoecarver updated this revision to Diff 251765.Mar 20 2020, 2:22 PM
zoecarver edited the summary of this revision. (Show Details)
  • Rebase off master
Herald added a project: Restricted Project. · View Herald TranscriptMar 20 2020, 2:22 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript

Friendly ping. This patch just tests so its a non-functional change.

ldionne accepted this revision.Mar 20 2020, 6:06 PM
This revision is now accepted and ready to land.Mar 20 2020, 6:06 PM
This revision was automatically updated to reflect the committed changes.