================
@@ -16183,7 +16183,12 @@ 
TreeTransform<Derived>::TransformCXXTemporaryObjectExpr(
       !ArgumentChanged) {
     // FIXME: Instantiation-specific
     SemaRef.MarkFunctionReferenced(E->getBeginLoc(), Constructor);
-    return SemaRef.MaybeBindToTemporary(E);
+    // The immediate-invocation wrapper was stripped by TransformConstantExpr;
+    // put it back before binding the temporary, as SemaInit does.
+    ExprResult Res = SemaRef.CheckForImmediateInvocation(E, Constructor);
+    if (Res.isInvalid())
+      return ExprError();
+    return SemaRef.MaybeBindToTemporary(Res.get());
----------------
cor3ntin wrote:

I think that we should try to preserve the ConstantExpr node in 
TransformConstantExpr, at least when the subexpression isn't modified by the 
transformation (but ideally in all cases).

`CheckForImmediateInvocation` is faily expensive and we should avoid doing that 
work multiple times if we can avoid it

https://github.com/llvm/llvm-project/pull/221816
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to