[PATCH] D45128: [libcxx][test] Silence -Wself-assign diagnostics
Roman Lebedev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 3 07:49:25 PDT 2018
lebedev.ri updated this revision to Diff 140788.
lebedev.ri added a comment.
The diagnostic was adjusted not to warn in an unevaluated context.
The remaining diff will have to remain, unless you want to disable `-Wself-assign` altogether for tests...
If there are remaining problems with this diff, please let me know; otherwise it would be **really** great to get this accepted!
Repository:
rCXX libc++
https://reviews.llvm.org/D45128
Files:
test/std/utilities/any/any.class/any.assign/copy.pass.cpp
test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_assign.pass.cpp
Index: test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_assign.pass.cpp
===================================================================
--- test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_assign.pass.cpp
+++ test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_assign.pass.cpp
@@ -92,28 +92,28 @@
{
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);
}
Index: test/std/utilities/any/any.class/any.assign/copy.pass.cpp
===================================================================
--- test/std/utilities/any/any.class/any.assign/copy.pass.cpp
+++ test/std/utilities/any/any.class/any.assign/copy.pass.cpp
@@ -102,7 +102,7 @@
// empty
{
any a;
- a = a;
+ a = (any &)a;
assertEmpty(a);
assert(globalMemCounter.checkOutstandingNewEq(0));
}
@@ -112,7 +112,7 @@
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 @@
any a(large(1));
assert(large::count == 1);
- a = a;
+ a = (any &)a;
assert(large::count == 1);
assertContains<large>(a, 1);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45128.140788.patch
Type: text/x-patch
Size: 2065 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180403/e0742de9/attachment.bin>
More information about the cfe-commits
mailing list