<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">On May 18, 2014, at 4:43 PM, Adam Strzelecki <<a href="mailto:ono@java.pl">ono@java.pl</a>> wrote:<br><div><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">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>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><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><div><br></div><div>John.</div></div></body></html>