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 zhouzho...@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); }
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); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits