[cfe-commits] PR7245: Make rvalue->reference copy errors into warnings. (issue1407042)

jyasskin at gmail.com jyasskin at gmail.com
Sun Jun 6 23:44:43 PDT 2010


Thanks for the sample code. I've added it to the test. I'll commit once
the svn server is back up.


http://codereview.appspot.com/1407042/diff/8001/9002
File include/clang/Basic/DiagnosticGroups.td (right):

http://codereview.appspot.com/1407042/diff/8001/9002#newcode76
include/clang/Basic/DiagnosticGroups.td:76: def RvalueCopyCtor :
DiagGroup<"rvalue-copy-ctor">;
On 2010/06/04 23:23:08, doug.gregor wrote:
> I think that the name "rvalue-copy-ctor" for this warning group is
somewhat
> misleading; this is about binding a reference to a temporary. I don't
have any
> great ideas, but perhaps something like "-Wbind-to-temporary-copy"?

Works for me.

http://codereview.appspot.com/1407042/diff/8001/9003
File include/clang/Basic/DiagnosticSemaKinds.td (right):

http://codereview.appspot.com/1407042/diff/8001/9003#newcode492
include/clang/Basic/DiagnosticSemaKinds.td:492: NoSFINAE,
InGroup<RvalueCopyCtor>;
On 2010/06/04 23:23:08, doug.gregor wrote:
> how about "when binding a reference to a temporary"

Done.

http://codereview.appspot.com/1407042/diff/8001/9003#newcode756
include/clang/Basic/DiagnosticSemaKinds.td:756: "constructor when
binding an rvalue to a reference">,
On 2010/06/04 23:23:08, doug.gregor wrote:
> same comment: "when binding a reference to a temporary" ?

Done.

http://codereview.appspot.com/1407042/diff/8001/9005
File lib/Sema/SemaInit.cpp (right):

http://codereview.appspot.com/1407042/diff/8001/9005#newcode3327
lib/Sema/SemaInit.cpp:3327: S.Diag(Loc, IsExtraneousCopy
On 2010/06/04 23:23:08, doug.gregor wrote:
> Use "IsExtraneousCopy && !S.isSFINAEContext()" to keep the error
within SFINAE
> context.

Done.

http://codereview.appspot.com/1407042/diff/8001/9005#newcode3334
lib/Sema/SemaInit.cpp:3334: return S.ExprError();
On 2010/06/04 23:23:08, doug.gregor wrote:
> You're going to need to make this:

>    if (!IsExtraneousCopy || S.isSFINAEContext())
>      return S.ExprError();
>    return move(CurInit);

> As it stands, you've downgraded the error to a warning, but the
initialization
> code is still returning an error.

Done, and I'm running a bootstrap on the assumption that that's where
this would have broken.

http://codereview.appspot.com/1407042/show



More information about the cfe-commits mailing list