[cfe-dev] Allow implicit copy constructor between address spaces in C++

Adam Strzelecki ono at java.pl
Sun May 25 07:04:58 PDT 2014


> I think the most general thing to do would be to teach SemaInit that a reference can bind to an object with a different address space if the initialized entity is the first parameter of a trivial copy or move constructor or assignment, and to teach it to add a new cross-address-space-copy step when that happens.

One thing that bothers me is that reference is kind of constant pointer, so dropping address space qualifier sounds kind of weird.

> Separately, overload resolution should be taught that this is possible; the first standard conversion sequence in such a case should probably have conversion rank.

I am afraid this isn't trivial change anymore. Do you think we could resolve these address-space issues before final 3.5?

> +        const RecordType *DestRecordType = DestType->getAs<RecordType>();
> +        CXXRecordDecl *DestRecordDecl
> +          = cast<CXXRecordDecl>(DestRecordType->getDecl());
> 
> This is just DestType->getAsCXXRecordDecl().

Thanks for a hint.

-- 
Adam



More information about the cfe-dev mailing list