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;
}
The inherited constructor will also be
noexcept(false)because as you quoted an inherited constructor will benoexcept(true)by defaultWhen the
Derivedconstructor runs it will also call theBaseconstructor which isnoexcept(false), therefore, theDerivedconstructor will also benoexcept(false).This is evidenced by the following.
Outputs 0.