Skip to content

Rejects valid direct initialization from prvalue (private destructor) #47370

Open
@llvmbot

Description

@llvmbot
Bugzilla Link 48026
Version unspecified
OS Linux
Reporter LLVM Bugzilla Contributor
CC @zygoloid

Extended Description

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

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillac++17clang:frontendLanguage frontend issues, e.g. anything involving "Sema"invalidResolved as invalid, i.e. not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions