Because of incomplete support for CXXDefaultArgExpr, we cannot yet commit to
asserting that the same destructor won't be elided twice.
Suppress the assertion failure for now. Proper support is still an open problem.
Differential Revision: https://reviews.llvm.org/D49213
llvm-svn: 338441
const CXXBindTemporaryExpr *BTE,
const LocationContext *LC) {
ConstructedObjectKey Key({BTE, /*IsElided=*/true}, LC);
- assert(!State->contains<ObjectsUnderConstruction>(Key));
+ // FIXME: Currently the state might already contain the marker due to
+ // incorrect handling of temporaries bound to default parameters.
return State->set<ObjectsUnderConstruction>(Key, UnknownVal());
}
#endif // TEMPORARY_DTORS
}
+namespace default_param_elided_destructors {
+struct a {
+ ~a();
+};
+struct F {
+ a d;
+ F(char *, a = a());
+};
+void g() {
+ char h[1];
+ for (int i = 0;;)
+ F j(i ? j : h);
+}
+} // namespace default_param_elided_destructors
+
void testStaticMaterializeTemporaryExpr() {
static const Trivial &ref = getTrivial();
clang_analyzer_eval(ref.value == 42); // expected-warning{{TRUE}}