<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, May 14, 2014 at 4:15 PM, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><p dir="ltr">> +bool CGCXXABI::canCopyArgument(const CXXRecordDecl *RD) const {<br>

> +  // If RD has a non-trivial move or copy constructor, we cannot copy the<br>
> +  // argument.<br>
> +  if (RD->hasNonTrivialCopyConstructor() || RD->hasNonTrivialMoveConstructor())<br>
> +    return false;<br>
> +<br>
> +  // If RD has a non-trivial destructor, we cannot copy the argument.<br>
> +  if (RD->hasNonTrivialDestructor())<br>
> +    return false;<br>
> +<br>
> +  // We can only copy the argument if there exists at least one trivial,<br>
> +  // non-deleted copy or move constructor.<br>
> +  // FIXME: This assumes that all lazily declared copy and move constructors are<br>
> +  // not deleted.  This assumption might not be true in some corner cases.<br>
> +  bool CopyOrMoveDeleted = false;<br>
> +  for (const CXXConstructorDecl *CD : RD->ctors()) {<br>
> +    if (CD->isCopyConstructor() || CD->isMoveConstructor()) {<br>
> +      assert(CD->isTrivial());<br>
> +      // We had at least one undeleted trivial copy or move ctor.  Return<br>
> +      // directly.<br>
> +      if (!CD->isDeleted())<br>
> +        return true;<br>
> +      CopyOrMoveDeleted = true;<br>
> +    }<br>
> +  }<br>
> +<br>
> +  // If all trivial copy and move constructors are deleted, we cannot copy the<br>
> +  // argument.<br>
> +  return !CopyOrMoveDeleted;</p>
</div></div><p dir="ltr">This returns false if either trivial copy or move is deleted. Shouldn't we only return false if both of them are?</p></blockquote><div>Is it possible to delete a copy or move constructor without forcing the other constructors to be declared?  They appear to go together.  It's good to be defensive though.<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">
<p dir="ltr">> +}<span style="color:rgb(34,34,34)"> </span></p></div></div></blockquote></div></div></div>