[libcxx] r329490 - [libcxx][test] Silence -Wself-assign diagnostics

Roman Lebedev via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 7 03:36:03 PDT 2018


Author: lebedevri
Date: Sat Apr  7 03:36:03 2018
New Revision: 329490

URL: http://llvm.org/viewvc/llvm-project?rev=329490&view=rev
Log:
[libcxx][test] Silence -Wself-assign diagnostics

Summary:
D44883 extends -Wself-assign to also work on C++ classes.
These new warnings pop up in the test suite, so they have to be silenced.

Please refer to the D45082 for disscussion on whether this is the right way to solve this.

Testing: `ninja check-libcxx check-libcxxabi` in stage-2 build.

Reviewers: mclow.lists, EricWF

Reviewed By: EricWF

Subscribers: Quuxplusone, cfe-commits

Differential Revision: https://reviews.llvm.org/D45128

Modified:
    libcxx/trunk/test/std/utilities/any/any.class/any.assign/copy.pass.cpp
    libcxx/trunk/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_assign.pass.cpp

Modified: libcxx/trunk/test/std/utilities/any/any.class/any.assign/copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/any/any.class/any.assign/copy.pass.cpp?rev=329490&r1=329489&r2=329490&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/any/any.class/any.assign/copy.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/any/any.class/any.assign/copy.pass.cpp Sat Apr  7 03:36:03 2018
@@ -102,7 +102,7 @@ void test_copy_assign_self() {
     // empty
     {
         any a;
-        a = a;
+        a = (any &)a;
         assertEmpty(a);
         assert(globalMemCounter.checkOutstandingNewEq(0));
     }
@@ -112,7 +112,7 @@ void test_copy_assign_self() {
         any a((small(1)));
         assert(small::count == 1);
 
-        a = a;
+        a = (any &)a;
 
         assert(small::count == 1);
         assertContains<small>(a, 1);
@@ -125,7 +125,7 @@ void test_copy_assign_self() {
         any a(large(1));
         assert(large::count == 1);
 
-        a = a;
+        a = (any &)a;
 
         assert(large::count == 1);
         assertContains<large>(a, 1);

Modified: libcxx/trunk/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_assign.pass.cpp?rev=329490&r1=329489&r2=329490&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_assign.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_assign.pass.cpp Sat Apr  7 03:36:03 2018
@@ -92,28 +92,28 @@ int main() {
   {
     typedef std::function<int()> Func;
     Func f = g0;
-    Func& fr = (f = f);
+    Func& fr = (f = (Func &)f);
     assert(&fr == &f);
     assert(*f.target<int(*)()>() == g0);
   }
   {
     typedef std::function<int(int)> Func;
     Func f = g;
-    Func& fr = (f = f);
+    Func& fr = (f = (Func &)f);
     assert(&fr == &f);
     assert(*f.target<int(*)(int)>() == g);
   }
   {
     typedef std::function<int(int, int)> Func;
     Func f = g2;
-    Func& fr = (f = f);
+    Func& fr = (f = (Func &)f);
     assert(&fr == &f);
     assert(*f.target<int(*)(int, int)>() == g2);
   }
   {
     typedef std::function<int(int, int, int)> Func;
     Func f = g3;
-    Func& fr = (f = f);
+    Func& fr = (f = (Func &)f);
     assert(&fr == &f);
     assert(*f.target<int(*)(int, int, int)>() == g3);
   }




More information about the cfe-commits mailing list