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

            Bug ID: 48026
           Summary: Rejects valid direct initialization from prvalue
                    (private destructor)
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++17
          Assignee: unassignedclangb...@nondot.org
          Reporter: leni...@gmail.com
                CC: blitzrak...@gmail.com, erik.pilking...@gmail.com,
                    llvm-bugs@lists.llvm.org, richard-l...@metafoo.co.uk

clang version 10.0.1 (https://github.com/llvm/llvm-project.git
ef32c611aa214dea855364efd7ba451ec5ec3f74)

options: -std=c++17 -O2 -pedantic-errors

clang++ rejects the following well-formed program:

struct A {
    private:
    ~A();

    public:
    static A f();
};

A* foo() {
    return new A(A::f());
}

https://godbolt.org/z/hffYq7

On the return line no destructor is invoked or potentially invoked.

-- 
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