Fix is_noexcept for implicit noexcept destructors when marked as default or deleted (#196)
This commit is contained in:
@@ -1481,13 +1481,12 @@ static bool isFunctionOrMethodNoexcept(const QualType QT) {
|
|||||||
if (T->isFunctionProtoType()) {
|
if (T->isFunctionProtoType()) {
|
||||||
// This covers (virtual) methods & functions
|
// This covers (virtual) methods & functions
|
||||||
const auto *FPT = T->getAs<FunctionProtoType>();
|
const auto *FPT = T->getAs<FunctionProtoType>();
|
||||||
|
|
||||||
switch (FPT->getExceptionSpecType()) {
|
switch (FPT->getExceptionSpecType()) {
|
||||||
case EST_BasicNoexcept:
|
case EST_BasicNoexcept:
|
||||||
case EST_NoexceptTrue:
|
case EST_NoexceptTrue:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -349,7 +349,13 @@ public:
|
|||||||
|
|
||||||
void EnsureInstantiationOfExceptionSpec(SourceLocation Loc,
|
void EnsureInstantiationOfExceptionSpec(SourceLocation Loc,
|
||||||
FunctionDecl *FD) override {
|
FunctionDecl *FD) override {
|
||||||
S.InstantiateExceptionSpec(Loc, FD);
|
const FunctionProtoType *Proto = FD->getType()->castAs<FunctionProtoType>();
|
||||||
|
if (Proto->getExceptionSpecType() == EST_Uninstantiated) {
|
||||||
|
S.InstantiateExceptionSpec(Loc, FD);
|
||||||
|
}
|
||||||
|
if (Proto->getExceptionSpecType() == EST_Unevaluated) {
|
||||||
|
S.ResolveExceptionSpec(Loc, Proto);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QualType Substitute(TypeAliasTemplateDecl *TD,
|
QualType Substitute(TypeAliasTemplateDecl *TD,
|
||||||
|
|||||||
@@ -703,6 +703,16 @@ static_assert(!is_noexcept(type_of(^^EC::Something)));
|
|||||||
static_assert(!is_noexcept(^^E));
|
static_assert(!is_noexcept(^^E));
|
||||||
static_assert(!is_noexcept(^^E_Something));
|
static_assert(!is_noexcept(^^E_Something));
|
||||||
static_assert(!is_noexcept(type_of(^^E_Something)));
|
static_assert(!is_noexcept(type_of(^^E_Something)));
|
||||||
|
|
||||||
|
// Defaulted special members
|
||||||
|
struct DelDest { ~DelDest() = delete; };
|
||||||
|
static_assert(is_noexcept (^^DelDest::~DelDest));
|
||||||
|
|
||||||
|
struct DefDest { ~DefDest() = default; };
|
||||||
|
static_assert(is_noexcept (^^DefDest::~DefDest));
|
||||||
|
|
||||||
|
struct EmptyStruct { };
|
||||||
|
static_assert(is_noexcept (^^EmptyStruct::~EmptyStruct));
|
||||||
} // namespace noexcept_functions
|
} // namespace noexcept_functions
|
||||||
|
|
||||||
// ================
|
// ================
|
||||||
|
|||||||
Reference in New Issue
Block a user