[cfe-commits] r82783 - in /cfe/trunk: lib/Sema/SemaExprCXX.cpp test/CodeGenCXX/PR5050-constructor-conversion.cpp
Fariborz Jahanian
fjahanian at apple.com
Fri Sep 25 11:20:30 PDT 2009
OK thanks, I will give it a spin.
- fariborz
On Sep 25, 2009, at 11:18 AM, Anders Carlsson wrote:
>
> On Sep 25, 2009, at 11:11 AM, Fariborz Jahanian wrote:
>
>> Author: fjahanian
>> Date: Fri Sep 25 13:11:25 2009
>> New Revision: 82783
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=82783&view=rev
>> Log:
>> Fix the AST tree so ir-gen can do the conversion via copy
>> construction.
>> Fixed pr5050.
>>
>
> Hi Fariborz,
>
> this isn't quite the right fix - it'll miss a qualification
> conversion if it's needed.
>
> The right fix is to use CompleteConstructorCall. Something like
>
> Index: lib/Sema/SemaExprCXX.cpp
> ===================================================================
> --- lib/Sema/SemaExprCXX.cpp (revision 82773)
> +++ lib/Sema/SemaExprCXX.cpp (working copy)
> @@ -1114,11 +1114,20 @@
> // FIXME: When can ToType be a reference type?
> assert(!ToType->isReferenceType());
>
> + ASTOwningVector<&ActionBase::DeleteExpr> ConstructorArgs(*this);
> +
> + SourceLocation ConstructLoc; /* FIXME */
> +
> + if (CompleteConstructorCall(SCS.CopyConstructor,
> + MultiExprArg(*this, (void **)&From,
> 1),
> + ConstructLoc,
> + ConstructorArgs))
> + return true;
> +
> OwningExprResult FromResult =
> - BuildCXXConstructExpr(/*FIXME:ConstructLoc*/SourceLocation(),
> - ToType, SCS.CopyConstructor,
> - MultiExprArg(*this, (void**)&From, 1));
> -
> + BuildCXXConstructExpr(ConstructLoc, ToType,
> SCS.CopyConstructor,
> + move_arg(ConstructorArgs));
> +
> if (FromResult.isInvalid())
> return true;
>
>
> Anders
>
More information about the cfe-commits
mailing list