[llvm-bugs] [Bug 51402] New: Incomplete type allowed for returned brace initialized unique_ptr

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Aug 7 09:28:33 PDT 2021


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

            Bug ID: 51402
           Summary: Incomplete type allowed for returned brace initialized
                    unique_ptr
           Product: clang
           Version: 12.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ammiera at hotmail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

I've checked previous versions and seems it's not a regression.

Returning unique_ptr<incomplete_type>{} vs {} (which should be equivalent)
either compiles or not. Trying to assign that returnred value actually triggers
a compilation error, too.

https://godbolt.org/z/qer8eczhx

#include <memory>

struct incomplete;

std::unique_ptr<incomplete> u()
{
    return {}; //this compiles
    // return std::unique_ptr<incomplete>{};// this one gives an error
}

int main(int, char*[])
{
    // auto x=u(); // this also gives compilation error
    return 0;
}

-- 
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/20210807/b0ea1dde/attachment.html>


More information about the llvm-bugs mailing list