<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, May 18, 2014 at 10:49 PM, John McCall <span dir="ltr"><<a href="mailto:rjmccall@apple.com" target="_blank">rjmccall@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div class="">On May 18, 2014, at 4:43 PM, Adam Strzelecki <<a href="mailto:ono@java.pl" target="_blank">ono@java.pl</a>> wrote:<br>
</div><div><div class=""><blockquote type="cite"><blockquote type="cite">The simplest solution here is probably to add a special case to the type-checker which permits an address-space mismatch when directly calling a trivial copy constructor or copy-assignment operator.<br>
</blockquote><br>I have submitted patch that works reasonably well without need to extra attributes or builtins.<br><br><a href="http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20140512/105706.html" target="_blank">http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20140512/105706.html</a><br>
<br>The idea behind was to enforce implicit conversion which drops address space qualifier if copy constructor fails and destination is POD without user defined copy constructor.<br></blockquote><div><br></div></div>Hmm. I’d like Richard’s opinion about where to do this. There are a lot of compile-time benefits to only changing the failure path during initialization, but I’m a little worried about having these exact conditions. Maybe the best thing to do is to just try again with an OpaqueValueExpr in the default address space and, if that succeeds and picks a trivial constructor, then you can go ahead and generate the C-style AST.</div>
</div></blockquote><div><br></div><div>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.</div>
<div><br></div><div>Separately, overload resolution should be taught that this is possible; the first standard conversion sequence in such a case should probably have conversion rank.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div><pre style="white-space:pre-wrap">+ const RecordType *DestRecordType = DestType->getAs<RecordType>();
+ CXXRecordDecl *DestRecordDecl
+ = cast<CXXRecordDecl>(DestRecordType->getDecl());
</pre><div>This is just DestType->getAsCXXRecordDecl().</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>John.</div></font></span></div></div><br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div></div>