From ccfe77fa220de72e10ca8818d65d3b2b73a2e062 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Thu, 26 Jul 2018 21:23:12 +0000 Subject: [PATCH] * 30_threads/condition_variable_any/cond.cc: New test. From-SVN: r263022 --- libstdc++-v3/ChangeLog | 4 +++ .../30_threads/condition_variable_any/cond.cc | 35 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 libstdc++-v3/testsuite/30_threads/condition_variable_any/cond.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 204b89b6c8c..00fb914b775 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,7 @@ +2018-07-26 Marek Polacek + + * testsuite/30_threads/condition_variable_any/cond.cc: New. + 2018-07-26 Marek Polacek * src/c++98/locale_init.cc: Fix #ifdef condition. diff --git a/libstdc++-v3/testsuite/30_threads/condition_variable_any/cond.cc b/libstdc++-v3/testsuite/30_threads/condition_variable_any/cond.cc new file mode 100644 index 00000000000..82a9e6673a7 --- /dev/null +++ b/libstdc++-v3/testsuite/30_threads/condition_variable_any/cond.cc @@ -0,0 +1,35 @@ +// { dg-do run } +// { dg-options "-pthread" } +// { dg-require-effective-target c++11 } +// { dg-require-effective-target pthread } +// { dg-require-gthreads "" } + +// Copyright (C) 2018 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +int main() +{ + const size_t sz = sizeof(std::condition_variable_any); + char garbage[sz]; + memset(garbage, 0xff, sz); + auto cond = new ((void*)garbage) std::condition_variable_any(); + cond->notify_all(); + cond->~condition_variable_any(); +} -- 2.30.2