[PATCH] D131194: [C++20] Fix crash-on-valid with consteval temporary construction through list initialization

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 4 12:39:48 PDT 2022

erichkeane added inline comments.

Comment at: clang/lib/CodeGen/CGExprConstant.cpp:1404
+  // default value here and reset the type only as needed.
+  QualType RetType = Inner->getType();
   if (auto *Call = dyn_cast<CallExpr>(Inner))
aaron.ballman wrote:
> erichkeane wrote:
> > Is there any possibility to have an assert somewhere to catch when this ISN'T the type we need to see later?  It would be nice to figure out what other cases we're missing below.
> Not that I've found yet, but if someone has ideas, I'm definitely open to them because I worry about that as well. I had originally tried just asserting that the value was valid, but a *bunch* of code calls this where the `RetType` doesn't matter and was tripping up that assertion.
Hrmph... ok.  I was hoping that if we 'messed up' the return type here, AND it was useful later, it would be 'caught' by a later assert. Or was something like that (Like in the `CXXFunctionalCastExpr` case?) already asserting in a callee?

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list