code like:
consteval int f() {
int *A = new int(0);
return *A;
}
int i1 = f();currently doesn't generate any error.
maybe a better solution is to make CheckMemoryLeaks return false when there is memory leaks.
Differential D74418
[clang] fix error detection in consteval calls Authored by Tyker on Feb 11 2020, 8:50 AM.
Details
code like: consteval int f() {
int *A = new int(0);
return *A;
}
int i1 = f();currently doesn't generate any error. maybe a better solution is to make CheckMemoryLeaks return false when there is memory leaks.
Diff Detail
Event TimelineComment Actions Given the comment at the start of lib/AST/ExprConstant.cpp, this seems reasonable to me. I do wonder if it'd be better to return an enum constant/not-constant-but-foldable/not-foldable from the evaluator, rather than just a bool. But not as part of this patch :) |