* include/std/future (packaged_task::operator bool): Rename to...
(packaged_task::valid): ...this.
* testsuite/30_threads/packaged_task/cons/1.cc: Adjust.
* testsuite/30_threads/packaged_task/cons/2.cc: Adjust.
* testsuite/30_threads/packaged_task/cons/move.cc: Adjust.
* testsuite/30_threads/packaged_task/cons/move_assign.cc: Adjust.
* testsuite/30_threads/packaged_task/cons/alloc.cc: Adjust.
* testsuite/30_threads/packaged_task/members/invoke.cc: Adjust.
* testsuite/30_threads/packaged_task/members/reset.cc: Adjust.
* testsuite/30_threads/packaged_task/members/reset2.cc: Adjust.
* testsuite/30_threads/packaged_task/members/swap.cc: Adjust.
* testsuite/30_threads/packaged_task/members/boolconv.cc: Remove.
* testsuite/30_threads/packaged_task/members/valid.cc: Add.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@169988
138bc75d-0d04-0410-961f-
82ee72b054a4
+2011-02-09 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * include/std/future (packaged_task::operator bool): Rename to...
+ (packaged_task::valid): ...this.
+ * testsuite/30_threads/packaged_task/cons/1.cc: Adjust.
+ * testsuite/30_threads/packaged_task/cons/2.cc: Adjust.
+ * testsuite/30_threads/packaged_task/cons/move.cc: Adjust.
+ * testsuite/30_threads/packaged_task/cons/move_assign.cc: Adjust.
+ * testsuite/30_threads/packaged_task/cons/alloc.cc: Adjust.
+ * testsuite/30_threads/packaged_task/members/invoke.cc: Adjust.
+ * testsuite/30_threads/packaged_task/members/reset.cc: Adjust.
+ * testsuite/30_threads/packaged_task/members/reset2.cc: Adjust.
+ * testsuite/30_threads/packaged_task/members/swap.cc: Adjust.
+ * testsuite/30_threads/packaged_task/members/boolconv.cc: Remove.
+ * testsuite/30_threads/packaged_task/members/valid.cc: Add.
+
2011-02-09 Paolo Carlini <paolo.carlini@oracle.com>
* doc/xml/manual/io.xml: Fix typo.
// <future> -*- C++ -*-
-// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
swap(packaged_task& __other)
{ _M_state.swap(__other._M_state); }
- explicit operator bool() const { return static_cast<bool>(_M_state); }
+ bool
+ valid() const
+ { return static_cast<bool>(_M_state); }
// Result retrieval
future<_Res>
// { dg-require-gthreads "" }
// { dg-require-atomic-builtins "" }
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
using namespace __gnu_test;
packaged_task<int ()> p1;
- VERIFY( !static_cast<bool>(p1) );
+ VERIFY( !p1.valid() );
packaged_task<int& ()> p2;
- VERIFY( !static_cast<bool>(p2) );
+ VERIFY( !p2.valid() );
packaged_task<void ()> p3;
- VERIFY( !static_cast<bool>(p3) );
+ VERIFY( !p3.valid() );
packaged_task<ClassType ()> p4;
- VERIFY( !static_cast<bool>(p4) );
+ VERIFY( !p4.valid() );
packaged_task<AbstractClass& (int)> p5;
- VERIFY( !static_cast<bool>(p5) );
+ VERIFY( !p5.valid() );
}
int main()
// { dg-require-gthreads "" }
// { dg-require-atomic-builtins "" }
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
using std::packaged_task;
packaged_task<int ()> p1(f1);
- VERIFY( static_cast<bool>(p1) );
+ VERIFY( p1.valid() );
packaged_task<int& ()> p2(f2);
- VERIFY( static_cast<bool>(p2) );
+ VERIFY( p2.valid() );
packaged_task<void ()> p3(f3);
- VERIFY( static_cast<bool>(p3) );
+ VERIFY( p3.valid() );
packaged_task<ClassType ()> p4(f4);
- VERIFY( static_cast<bool>(p4) );
+ VERIFY( p4.valid() );
packaged_task<AbstractClass& (int)> p5(f5);
- VERIFY( static_cast<bool>(p5) );
+ VERIFY( p5.valid() );
}
int main()
// { dg-require-gthreads "" }
// { dg-require-atomic-builtins "" }
-// Copyright (C) 2010 Free Software Foundation, Inc.
+// Copyright (C) 2010, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
uneq_allocator<char> alloc(99);
packaged_task<int ()> p1(allocator_arg, alloc, f);
- VERIFY( static_cast<bool>(p1) );
+ VERIFY( p1.valid() );
p1();
VERIFY( p1.get_future().get() == 5 );
}
// { dg-require-gthreads "" }
// { dg-require-atomic-builtins "" }
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// move
packaged_task<int()> p1(f1);
packaged_task<int()> p2(std::move(p1));
- VERIFY( !static_cast<bool>(p1) );
- VERIFY( static_cast<bool>(p2) );
+ VERIFY( !p1.valid() );
+ VERIFY( p2.valid() );
}
int main()
// { dg-require-gthreads "" }
// { dg-require-atomic-builtins "" }
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
std::packaged_task<int()> p1;
std::packaged_task<int()> p2(gen);
p1 = std::move(p2);
- VERIFY( static_cast<bool>(p1) );
- VERIFY( !static_cast<bool>(p2) );
+ VERIFY( p1.valid() );
+ VERIFY( !p2.valid() );
}
int main()
// { dg-require-gthreads "" }
// { dg-require-atomic-builtins "" }
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
p1();
- VERIFY( static_cast<bool>(p1) );
+ VERIFY( p1.valid() );
VERIFY( f1.get() == 0 );
}
// { dg-require-gthreads "" }
// { dg-require-atomic-builtins "" }
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009. 2010, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
future<int> f1 = p1.get_future();
p1.reset();
- VERIFY( static_cast<bool>(p1) );
+ VERIFY( p1.valid() );
future<int> f2 = p1.get_future();
// { dg-require-gthreads "" }
// { dg-require-atomic-builtins "" }
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
p1();
p1.reset();
- VERIFY( static_cast<bool>(p1) );
+ VERIFY( p1.valid() );
VERIFY( f1.get() == 0 );
std::future<int> f2 = p1.get_future();
// { dg-require-gthreads "" }
// { dg-require-atomic-builtins "" }
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
std::packaged_task<int()> p1(zero);
std::packaged_task<int()> p2;
- VERIFY( static_cast<bool>(p1) );
- VERIFY( !static_cast<bool>(p2) );
+ VERIFY( p1.valid() );
+ VERIFY( !p2.valid() );
p1.swap(p2);
- VERIFY( !static_cast<bool>(p1) );
- VERIFY( static_cast<bool>(p2) );
+ VERIFY( !p1.valid() );
+ VERIFY( p2.valid() );
}
int main()
// { dg-require-gthreads "" }
// { dg-require-atomic-builtins "" }
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
bool test __attribute__((unused)) = true;
std::packaged_task<int()> p1;
- VERIFY( !static_cast<bool>(p1) );
+ VERIFY( !p1.valid() );
std::packaged_task<int()> p2(zero);
- VERIFY( static_cast<bool>(p2) );
+ VERIFY( p2.valid() );
}
int main()