【发布时间】:2016-06-17 12:00:02
【问题描述】:
Here我发现:
默认情况下,继承构造函数 [...] 都是 noexcept(true),除非它们需要调用 noexcept(false) 的函数,在这种情况下,这些函数是 noexcept(false)。
这是否意味着在下面的示例中,继承的构造函数是noexcept(true),即使它已在基类中明确定义为noexcept(false),或者它本身被视为一个没有例外的函数(false) 被调用?
struct Base {
Base() noexcept(false) { }
};
struct Derived: public Base {
using Base::Base;
};
int main() {
Derived d;
}
【问题讨论】:
标签: c++ c++11 constructor noexcept inheriting-constructors