[clang] [clang][Interp] Only evaluate the source array initialization of an `ArrayInitLoopExpr` once (PR #68039)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Oct 22 05:54:48 PDT 2023
================
@@ -847,7 +845,33 @@ template <class Emitter>
bool ByteCodeExprGen<Emitter>::VisitOpaqueValueExpr(const OpaqueValueExpr *E) {
if (Initializing)
return this->visitInitializer(E->getSourceExpr());
- return this->visit(E->getSourceExpr());
+
+ PrimType CacheVariableTy = classify(E).value_or(PT_Ptr);
----------------
isuckatcs wrote:
I added a test case like that.
```
constexpr int foo() { return X(0) ?: X(0); }
```
```
`-OpaqueValueExpr ... 'X':'X' xvalue
`-MaterializeTemporaryExpr ... 'X':'X' xvalue
`-CXXFunctionalCastExpr ... 'X':'X' functional cast to X <NoOp>
`-CXXParenListInitExpr ... 'X':'X'
`-IntegerLiteral ... 'int' 0
```
https://github.com/llvm/llvm-project/pull/68039
More information about the cfe-commits
mailing list