Does deleted destructor change aggregate initialization in C++?

  aggregate, c++, default-constructor, language-lawyer

The code as follows

struct B {
    ~B() = delete;
};

B * b = new B{};

fails to compile in the latest MSVC with the error:

error C2512: 'B': no appropriate default constructor available
note: Invalid aggregate initialization

At the same time both GCC and Clang do not see anything wrong in the code, demo: https://gcc.godbolt.org/z/va9vcsEed

Is it right to assume just a bug in MSVC?

Overall, does the presence or deletion of the destructor change any rule of the aggregate initialization?

Source: Windows Questions C++

LEAVE A COMMENT