[PATCH] D146801: [clang] Fix consteval initializers of temporaries
Mariya Podchishchaeva via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 24 07:13:44 PDT 2023
Fznamznon added inline comments.
================
Comment at: clang/lib/Sema/SemaExprCXX.cpp:1593-1595
+ if (ConstantExpr *CE = dyn_cast_or_null<ConstantExpr>(Inner))
+ if (CE->isImmediateInvocation())
+ Inner = CE->getSubExpr();
----------------
aaron.ballman wrote:
> This will need reformatting, but because we can use C++17 features, we can be slightly fancier here. :-)
>
> NB: I think we don't need to use `dyn_cast_or_null` here or on the predicate above. We're calling `isa<Whatever>(Inner)` immediately below and that will assert if `Inner` was null, so it seems like we're already relying on `Inner` being nonnull.
That makes sense, thank you.
Although, I can't make `CE` const because `Inner` is not `const`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D146801/new/
https://reviews.llvm.org/D146801
More information about the cfe-commits
mailing list