[PATCH] D146801: [clang] Fix consteval initializers of temporaries

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 24 06:39:15 PDT 2023


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

The changes LGTM (though I had a small nit), but you should add a release note when landing.



================
Comment at: clang/lib/Sema/SemaExprCXX.cpp:1593-1595
+  if (ConstantExpr *CE = dyn_cast_or_null<ConstantExpr>(Inner))
+    if (CE->isImmediateInvocation())
+      Inner = CE->getSubExpr();
----------------
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.


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