C++Guns – RoboBlog


C++ Guns: C++20 Aggregates can no longer declare constructors

Filed under: Allgemein — Tags: — Thomas @ 21:01

Ab GCC 9.
P1008 Prohibit aggregates with user-declared constructors
Initialization in modern C++ - Timur Doumler - Meeting C++ 2018

struct A {
    A() = delete;

auto func() {
    // ok does not compile
    // A a; 
    // compiles in c++17 but not in 20
    A a{};      // error: use of deleted function 'A::A()'

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress