C++Guns – RoboBlog

30.01.2019

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

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

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