jeudi 3 mars 2016

Are inheriting constructors noexcept(true) by default?

Here I found that:

Inheriting constructors [...] are all noexcept(true) by default, unless they are required to call a function that is noexcept(false), in which case these functions are noexcept(false).

Does it mean that in the following example the inherited constructor is noexcept(true), even though it has been explicitly defined as noexcept(false) in the base class, or it is considered for itself as a function that is noexcept(false) to be called?

struct Base {
    Base() noexcept(false) { }
};

struct Derived: public Base {
    using Base::Base;
};

int main() {
    Derived d;
}

Aucun commentaire:

Enregistrer un commentaire