[PATCH] D119493: Fixing surplus assert condition in EvaluateTemporary
zhouyizhou via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 10 15:25:31 PST 2022
zhouyizhou created this revision.
zhouyizhou added reviewers: rsmith, hokein.
zhouyizhou requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
In LLVM/Clang Debug build, following code will trigger the assert to fire:
typedef int I;
void foo() {
int i = (int().I::~I(), 3);
}
I think the non record type temporary object should also be allowed here.
Thanks
Zhouyi Zhou
zhouzhouyi at gmail.com
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D119493
Files:
clang/lib/AST/ExprConstant.cpp
Index: clang/lib/AST/ExprConstant.cpp
===================================================================
--- clang/lib/AST/ExprConstant.cpp
+++ clang/lib/AST/ExprConstant.cpp
@@ -10173,7 +10173,7 @@
/// Evaluate an expression of record type as a temporary.
static bool EvaluateTemporary(const Expr *E, LValue &Result, EvalInfo &Info) {
assert(!E->isValueDependent());
- assert(E->isPRValue() && E->getType()->isRecordType());
+ assert(E->isPRValue());
return TemporaryExprEvaluator(Info, Result).Visit(E);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119493.407700.patch
Type: text/x-patch
Size: 522 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220210/160cfb0c/attachment.bin>
More information about the cfe-commits
mailing list