Tyker added inline comments.

================
Comment at: clang/lib/AST/ExprConstant.cpp:13618
+  if (InPlace) {
+    LValue LVal;
+    if (!::EvaluateInPlace(Result.Val, Info, LVal, this) ||
----------------
rsmith wrote:
> This isn't sufficient: the evaluation process can refer back to the object 
> under construction (eg, via `this`), and we need an lvalue that actually 
> names the result in order for this to work.
> 
> I think you'll need to do something like creating a suitable object (perhaps 
> a `LifetimeExtendedTemporaryDecl`) in the caller to represent the result of 
> the immediate invocation, and passing that into here.
i believe this solution should work. without LifetimeExtendedTemporaryDecl 
because reference/pointer on temporaries are not valid results of constant 
evaluation. so the AST should never store an APValue whose LValue is a 
ConstantExpr.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63960/new/

https://reviews.llvm.org/D63960



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to