-// { dg-options "-std=gnu++0x" }
+// { dg-do run { target c++11 } }
+// { dg-require-atomic-cmpxchg-word "" }
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009-2024 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
int main()
{
- bool test __attribute__((unused)) = true;
std::atomic_flag f = ATOMIC_FLAG_INIT;
- f.clear(); // set to false
+ f.clear(); // set to false
+ VERIFY( false == f.test_and_set() ); // return true
+ VERIFY( true == f.test_and_set() ); // return true
+ f.clear(); // set to false
VERIFY( false == f.test_and_set() ); // return previous false, set to true
- VERIFY( true == f.test_and_set() ); // return true
-
- return 0;
}