Page MenuHomePhabricator

[libcxx] Fix LWG 2874: Constructor shared_ptr::shared_ptr(Y*) should be constrained.
Needs ReviewPublic

Authored by zoecarver on Jun 8 2020, 12:04 PM.

Details

Reviewers
ldionne
Group Reviewers
Restricted Project
Summary

Fix LWG 2874.

Diff Detail

Event Timeline

zoecarver created this revision.Jun 8 2020, 12:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 8 2020, 12:04 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
ldionne requested changes to this revision.Jun 9 2020, 8:05 AM

Nitpick: You've got the wrong LWG number in your commit message.

Also, can you please mark the LWG issue as complete in the docs?

libcxx/include/memory
3565

You are eagerly instantiating all templates here, and I don't think that's what you want. For example, you'll instantiate __well_formed_delete_op<_Yp*> even when is_array<_Tp>::value is true.

libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr_Y.pass.cpp
122

STD_TEST_VERSION doesn't exist, it's TEST_STD_VER.

To catch these sorts of errors, it can be good to add tests and witness their failure before actually fixing them.

This revision now requires changes to proceed.Jun 9 2020, 8:05 AM
zoecarver edited the summary of this revision. (Show Details)Jun 9 2020, 9:17 PM
zoecarver marked an inline comment as done.Jun 9 2020, 9:25 PM
zoecarver added inline comments.
libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr_Y.pass.cpp
122

Oops, you're right. Somehow that got suck in my clipboard history.

zoecarver updated this revision to Diff 269730.Jun 9 2020, 9:28 PM
  • Update status.
  • Use TEST_STD_VER instead of the non-existant STD_TEST_VERSION.
  • Use std::conditional (instead of logical and/or).