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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-dev/] [fsf-gcc-snapshot-1-mar-12/] [or1k-gcc/] [libstdc++-v3/] [testsuite/] [20_util/] [tuple/] [creation_functions/] [constexpr.cc] - Blame information for rev 783

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 742 jeremybenn
// { dg-do compile }
2
// { dg-options "-std=gnu++0x" }
3
 
4
// Copyright (C) 2011 Free Software Foundation, Inc.
5
//
6
// This file is part of the GNU ISO C++ Library.  This library is free
7
// software; you can redistribute it and/or modify it under the
8
// terms of the GNU General Public License as published by the
9
// Free Software Foundation; either version 3, or (at your option)
10
// any later version.
11
 
12
// This library is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
// GNU General Public License for more details.
16
 
17
// You should have received a copy of the GNU General Public License along
18
// with this library; see the file COPYING3.  If not see
19
// <http://www.gnu.org/licenses/>.
20
 
21
 
22
// NOTE: This makes use of the fact that we know how moveable
23
// is implemented on pair, and also vector. If the implementation
24
// changes this test may begin to fail.
25
 
26
#include <tuple>
27
 
28
bool test __attribute__((unused)) = true;
29
 
30
 
31
// make_tuple
32
void
33
test_make_tuple()
34
{
35
  {
36
    typedef std::tuple<int, float> tuple_type;
37
    constexpr tuple_type p1 __attribute__((unused))
38
      = std::make_tuple(22, 22.222);
39
  }
40
 
41
  {
42
    typedef std::tuple<int, float, int> tuple_type;
43
    constexpr tuple_type p1 __attribute__((unused))
44
      = std::make_tuple(22, 22.222, 77799);
45
  }
46
}
47
 
48
// get
49
void
50
test_get()
51
{
52
  {
53
    typedef std::tuple<int, float> tuple_type;
54
    constexpr tuple_type t1 { 55, 77.77 };
55
    constexpr auto var __attribute__((unused))
56
      = std::get<1>(t1);
57
  }
58
 
59
  {
60
    typedef std::tuple<int, float, int> tuple_type;
61
    constexpr tuple_type t1 { 55, 77.77, 99 };
62
    constexpr auto var __attribute__((unused))
63
      = std::get<2>(t1);
64
  }
65
}
66
 
67
// tuple_cat
68
void
69
test_tuple_cat()
70
{
71
  typedef std::tuple<int, float>        tuple_type1;
72
  typedef std::tuple<int, int, float> tuple_type2;
73
 
74
  constexpr tuple_type1 t1 { 55, 77.77 };
75
  constexpr tuple_type2 t2 { 55, 99, 77.77 };
76
  constexpr auto cat1 __attribute__((unused)) = std::tuple_cat(t1, t2);
77
}
78
 
79
int
80
main()
81
{
82
  test_make_tuple();
83
  test_get();
84
  test_tuple_cat();
85
 
86
  return 0;
87
}

powered by: WebSVN 2.1.0

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