[llvm-bugs] [Bug 28929] New: make_shared accesses protected constructors

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Aug 10 11:42:16 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=28929

            Bug ID: 28929
           Summary: make_shared accesses protected constructors
           Product: libc++
           Version: 3.9
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: aaron at aaronballman.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
    Classification: Unclassified

Consider the following code:

#include <memory>

struct S {
private:
  S();

 public:
   void f() { (void)std::make_shared<S>(); }
};

struct T {
protected:
  T();

 public:
   void f() { (void)std::make_shared<T>(); }
};

S::f() will fail to compile because S::S() is private, but T::f() does not fail
to compile with a protected constructor. Giving the class a data member, or
marking the class as final, will cause T::f() to fail as well. Likely caused by
use of EBO.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160810/f4dc173c/attachment.html>


More information about the llvm-bugs mailing list