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: unassignedclangb...@nondot.org
          Reporter: ammi...@hotmail.com
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to