cxxConstructExpr(
hasType(cxxRecordDecl(
isSameOrDerivedFrom(matchesName("[Ee]xception|EXCEPTION")))),
- unless(anyOf(hasAncestor(stmt(
- anyOf(cxxThrowExpr(), callExpr(), returnStmt()))),
- hasAncestor(decl(anyOf(varDecl(), fieldDecl()))),
- allOf(hasAncestor(CtorInitializerList),
- unless(hasAncestor(cxxCatchStmt()))))))
+ unless(anyOf(
+ hasAncestor(
+ stmt(anyOf(cxxThrowExpr(), callExpr(), returnStmt()))),
+ hasAncestor(decl(anyOf(varDecl(), fieldDecl()))),
+ hasAncestor(expr(cxxNewExpr(hasAnyPlacementArg(anything())))),
+ allOf(hasAncestor(CtorInitializerList),
+ unless(hasAncestor(cxxCatchStmt()))))))
.bind("temporary-exception-not-thrown"),
this);
}
- Fixed a false positive in :doc:`fuchsia-trailing-return
<clang-tidy/checks/fuchsia-trailing-return>` for C++17 deduction guides.
+
+- Fixed a false positive in :doc:`bugprone-throw-keyword-missing
+ <clang-tidy/checks/bugprone-throw-keyword-missing>` when creating an exception object
+ using placement new
Removed checks
^^^^^^^^^^^^^^
void exceptionRAIITest() {
ExceptionRAII E;
}
+
+namespace std {
+typedef decltype(sizeof(void*)) size_t;
+}
+
+void* operator new(std::size_t, void*);
+
+void placeMentNewTest() {
+ alignas(RegularException) unsigned char expr[sizeof(RegularException)];
+ new (expr) RegularException{};
+}