]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/20_util/function/cons/lwg2774.cc
1 // { dg-do run { target c++11 } }
2 // { dg-require-effective-target hosted }
5 #include <testsuite_hooks.h>
10 Funk(const Funk
&) { ++copies
; }
11 Funk(Funk
&&) { ++moves
; }
13 void operator()() const { }
25 // LWG 2774 means there should be no move here:
26 std::function
<void()> fc(e
);
27 VERIFY(Funk::copies
== 1);
28 VERIFY(Funk::moves
== 0);
29 // And only one move here:
30 std::function
<void()> fm(std::move(e
));
31 VERIFY(Funk::copies
== 1);
32 VERIFY(Funk::moves
== 1);