OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libstdc++-v3/] [testsuite/] [23_containers/] [vector/] [debug/] [alloc_prop.cc] - Blame information for rev 747

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 742 jeremybenn
// Copyright (C) 2011 Free Software Foundation, Inc.
2
//
3
// This file is part of the GNU ISO C++ Library.  This library is free
4
// software; you can redistribute it and/or modify it under the
5
// terms of the GNU General Public License as published by the
6
// Free Software Foundation; either version 3, or (at your option)
7
// any later version.
8
//
9
// This library is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License along
15
// with this library; see the file COPYING3.  If not see
16
// <http://www.gnu.org/licenses/>.
17
//
18
// { dg-do compile }
19
// { dg-options "-std=gnu++11" }
20
 
21
#include <debug/vector>
22
#include <type_traits>
23
#include <testsuite_allocator.h>
24
 
25
template<typename T, typename A>
26
  void
27
  test()
28
  {
29
    typedef std::vector<T, A>         base;
30
    typedef __gnu_debug::vector<T, A> debug;
31
 
32
    using std::is_nothrow_default_constructible;
33
    using std::is_nothrow_copy_constructible;
34
    using std::is_nothrow_move_constructible;
35
    using std::is_nothrow_copy_assignable;
36
    using std::is_nothrow_move_assignable;
37
 
38
    static_assert(
39
        is_nothrow_default_constructible<base>::value
40
        == is_nothrow_default_constructible<debug>::value,
41
        "nothrow default constructible");
42
 
43
    static_assert(
44
        is_nothrow_copy_constructible<base>::value
45
        == is_nothrow_copy_constructible<debug>::value,
46
        "nothrow copy constructible");
47
 
48
    static_assert(
49
        is_nothrow_move_constructible<base>::value
50
        == is_nothrow_move_constructible<debug>::value,
51
        "nothrow move constructible");
52
 
53
    static_assert(
54
        is_nothrow_copy_assignable<base>::value
55
        == is_nothrow_copy_assignable<debug>::value,
56
        "nothrow move assignable");
57
 
58
    static_assert(
59
        is_nothrow_move_assignable<base>::value
60
        == is_nothrow_move_assignable<debug>::value,
61
        "nothrow move assignable");
62
  }
63
 
64
struct X
65
{
66
  X() { }
67
  ~X() { }
68
  X(const X&) { }
69
  X(X&&) { }
70
  X& operator=(const X&) { }
71
  X& operator=(X&&) { }
72
};
73
 
74
int main()
75
{
76
  using __gnu_test::propagating_allocator;
77
  using __gnu_test::SimpleAllocator;
78
 
79
  test<int, std::allocator<int>>();
80
  test<int, SimpleAllocator<int>>();
81
  test<int, propagating_allocator<int, true>>();
82
  test<int, propagating_allocator<int, false>>();
83
  test<X, std::allocator<X>>();
84
  test<X, SimpleAllocator<X>>();
85
  test<X, propagating_allocator<X, true>>();
86
  test<X, propagating_allocator<X, false>>();
87
 
88
  return 0;
89
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.