diff options
Diffstat (limited to 'libstdc++-v3/testsuite/20_util')
4 files changed, 93 insertions, 7 deletions
diff --git a/libstdc++-v3/testsuite/20_util/bind/ref_neg.cc b/libstdc++-v3/testsuite/20_util/bind/ref_neg.cc index 4534d1d..f5b5a019 100644 --- a/libstdc++-v3/testsuite/20_util/bind/ref_neg.cc +++ b/libstdc++-v3/testsuite/20_util/bind/ref_neg.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2010, 2011 Free Software Foundation, Inc. +// Copyright (C) 2010-2012 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 @@ -15,7 +15,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// 20.7.11 Function template bind +// 20.8.9 Function template bind // { dg-do compile } // { dg-options "-std=gnu++0x" } @@ -30,10 +30,10 @@ void test01() { const int dummy = 0; std::bind(&inc, _1)(0); // { dg-error "no match" } - // { dg-error "rvalue|const" "" { target *-*-* } 1207 } - // { dg-error "rvalue|const" "" { target *-*-* } 1221 } - // { dg-error "rvalue|const" "" { target *-*-* } 1235 } - // { dg-error "rvalue|const" "" { target *-*-* } 1249 } + // { dg-error "rvalue|const" "" { target *-*-* } 1206 } + // { dg-error "rvalue|const" "" { target *-*-* } 1220 } + // { dg-error "rvalue|const" "" { target *-*-* } 1234 } + // { dg-error "rvalue|const" "" { target *-*-* } 1248 } std::bind(&inc, std::ref(dummy))(); // { dg-error "no match" } } diff --git a/libstdc++-v3/testsuite/20_util/function/cons/55320.cc b/libstdc++-v3/testsuite/20_util/function/cons/55320.cc new file mode 100644 index 0000000..611e8ac --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/function/cons/55320.cc @@ -0,0 +1,46 @@ +// Copyright (C) 2012 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 +// <http://www.gnu.org/licenses/>. + +// libstdc++/55320 + +// { dg-options "-std=gnu++0x" } + +#include <functional> +#include <testsuite_hooks.h> + +struct X +{ + X() { ++count; } + X(const X&) { throw 1; } + ~X() { --count; } + void operator()() { } + static int count; +}; + +int X::count = 0; + +int main() +{ + try + { + std::function<void()> f = X(); + } + catch (int) + { + VERIFY( X::count == 0 ); + } +} diff --git a/libstdc++-v3/testsuite/20_util/function/cons/addressof.cc b/libstdc++-v3/testsuite/20_util/function/cons/addressof.cc new file mode 100644 index 0000000..25b6fb8 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/function/cons/addressof.cc @@ -0,0 +1,41 @@ +// Copyright (C) 2012 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 +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +#include <functional> + +struct F +{ + void operator()() { } + void operator&() const { } +}; + +void test01() +{ + F f; + std::function<void()> f1 = f; + std::function<void()> f2 = std::ref(f); +} + +int main() +{ + test01(); + + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/function/cons/callable.cc b/libstdc++-v3/testsuite/20_util/function/cons/callable.cc index 209c404..9f16125 100644 --- a/libstdc++-v3/testsuite/20_util/function/cons/callable.cc +++ b/libstdc++-v3/testsuite/20_util/function/cons/callable.cc @@ -19,7 +19,6 @@ // <http://www.gnu.org/licenses/>. #include <functional> -#include <testsuite_hooks.h> void* f(std::function<void()>) { return nullptr; } int f(std::function<void(int)>) { return 1; } |