[cfe-commits] r105487 - in /cfe/trunk: lib/CodeGen/CGBlocks.cpp lib/Sema/SemaExpr.cpp test/CodeGenCXX/copy-in-cplus-object.cpp

Fariborz Jahanian fjahanian at apple.com
Mon Jun 7 09:16:29 PDT 2010


On Jun 4, 2010, at 3:37 PM, Douglas Gregor wrote:

>
> On Jun 4, 2010, at 2:35 PM, Fariborz Jahanian wrote:
>
>> urceLocation());
>> +
>> +      OwningExprResult Res = PerformCopyInitialization(
>> +                       
>> InitializedEntity::InitializeResult(SourceLocation(),
>> +                                                          T, false),
>> +                      SourceLocation(),
>> +                      Owned(E));
>
> The use of InitializeResult is a little strange, since that's meant  
> for function return values. None of the current InitializedEntities  
> really fits this case. Perhaps we should add a new initialized  
> entity for captured block variables? It could greatly improve  
> diagnostics for this case.
>
>> +      if (!Res.isInvalid()) {
>> +        Expr *Init = Res.takeAs<Expr>();
>> +        if (isa<CXXConstructExpr>(Init))
>> +          BDRE->setCopyConstructorExpr(Init);
>> +      }
>
> This code should call MaybeCreateCXXExprWithTemporaries to destroy  
> any temporaries created as part of the call to the copy constructor,  
> e.g., for a copy constructor such as:
>
> 	X(const X&, const std::string &Silly = "silly");
>
> where we need to destroy the temporary std::string.

This is done in r105533.
- Fariborz

>
>
> 	- Doug
>




More information about the cfe-commits mailing list