[PATCH] D151587: [clang][ConstantEmitter] have tryEmitPrivate[ForVarInit] try ConstExprEmitter fast-path first
Eli Friedman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 9 10:02:40 PDT 2023
efriedma added inline comments.
================
Comment at: clang/lib/CodeGen/CGExprConstant.cpp:1279
+ if (isa<MaterializeTemporaryExpr>(E))
+ return nullptr;
+
----------------
efriedma wrote:
> This needs a comment explaining why we're bailing out here.
We might need to do a recursive visit still, to handle the cases noted at https://en.cppreference.com/w/cpp/language/reference_initialization#Lifetime_of_a_temporary . Not constructors, but other things. I think we don't have existing testcases, but for example `typedef int x[2]; struct Z { int &&x, y; }; Z z = { x{1,2}[0], z.x=10 };`
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D151587/new/
https://reviews.llvm.org/D151587
More information about the cfe-commits
mailing list