[PATCH] D28253: static_assert inside make_shared when the object is not constructible

Marshall Clow via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 3 13:57:19 PST 2017


mclow.lists created this revision.
mclow.lists added a reviewer: EricWF.
mclow.lists added a subscriber: cfe-commits.

http://llvm.org/show_bug.cgi?id=28929 shows a scenario where `make_shared` of a class with a protected constructor compiles successfully (it should fail).

This is because we apply an empty-base class optimization to the shared_ptr.

This is one way to solve the problem; there are probably others.
However, this works, and passes all the tests (including the two new ones I just added).


https://reviews.llvm.org/D28253

Files:
  include/memory
  test/libcxx/test/config.py
  test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.private.fail.cpp
  test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.protected.fail.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28253.82947.patch
Type: text/x-patch
Size: 6800 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170103/155b7c7b/attachment.bin>


More information about the cfe-commits mailing list