[llvm-bugs] [Bug 39363] New: Cannot construct unique_ptr with pointer to incomplete type

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Oct 19 20:07:10 PDT 2018


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

            Bug ID: 39363
           Summary: Cannot construct unique_ptr with pointer to incomplete
                    type
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: zturner at google.com
                CC: eric at efcs.ca, llvm-bugs at lists.llvm.org,
                    mclow.lists at gmail.com, mclow at qti.qualcomm.com

https://godbolt.org/z/a8ml4u

#include <memory>

struct foo;

struct bar
{
    // ok
    std::unique_ptr<foo> a;

    // ok
    std::unique_ptr<foo> b{};

    // not ok
    std::unique_ptr<foo> c{nullptr};
};

According to http://eel.is/c++draft/unique.ptr#4.sentence-3, it should be ok
for the type to be incomplete.  Since this is construction and not assignment,
it is not necessary to call delete and so we don't need to do a reset, hence we
shouldn't yet require a complete type.

-- 
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/20181020/af818801/attachment.html>


More information about the llvm-bugs mailing list