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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [torture/] [pr44972.C] - Blame information for rev 801

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

Line No. Rev Author Line
1 693 jeremybenn
/* { dg-do compile } */
2
 
3
#include
4
#include
5
#include
6
 
7
namespace boost {
8
 
9
template
10
class optional;
11
 
12
class aligned_storage
13
{
14
        char data[ 1000 ];
15
  public:
16
    void const* address() const { return &data[0]; }
17
    void      * address()       { return &data[0]; }
18
} ;
19
 
20
 
21
template
22
class optional_base
23
{
24
  protected :
25
    optional_base(){}
26
    optional_base ( T const& val )
27
    {
28
      construct(val);
29
    }
30
 
31
    template
32
    void assign ( optional const& rhs )
33
    {
34
      if (!is_initialized())
35
        if ( rhs.is_initialized() )
36
          construct(T());
37
    }
38
 
39
  public :
40
 
41
    bool is_initialized() const { return m_initialized ; }
42
 
43
  protected :
44
 
45
    void construct ( T const& val )
46
     {
47
       new (m_storage.address()) T(val) ;
48
     }
49
 
50
    T const* get_ptr_impl() const
51
    { return static_cast(m_storage.address()); }
52
 
53
  private :
54
 
55
    bool m_initialized ;
56
    aligned_storage  m_storage ;
57
} ;
58
 
59
 
60
template
61
class optional : public optional_base
62
{
63
    typedef optional_base base ;
64
 
65
  public :
66
 
67
    optional() : base() {}
68
    optional ( T const& val ) : base(val) {}
69
    optional& operator= ( optional const& rhs )
70
      {
71
        this->assign( rhs ) ;
72
        return *this ;
73
      }
74
 
75
    T const& get() const ;
76
 
77
    T const* operator->() const { assert(this->is_initialized()) ; return this->get_ptr_impl() ; }
78
 
79
} ;
80
 
81
 
82
} // namespace boost
83
 
84
 
85
namespace std
86
{
87
 
88
  template
89
    struct array
90
    {
91
      typedef _Tp                                     value_type;
92
      typedef const value_type*                       const_iterator;
93
 
94
      value_type _M_instance[_Nm];
95
 
96
    };
97
}
98
 
99
 
100
class NT
101
{
102
  double _inf, _sup;
103
};
104
 
105
 
106
template < typename T > inline
107
std::array
108
make_array(const T& b1)
109
{
110
  std::array a = { { b1 } };
111
  return a;
112
}
113
 
114
class V
115
{
116
  typedef std::array               Base;
117
  Base base;
118
 
119
public:
120
  V() {}
121
  V(const NT &x)
122
    : base(make_array(x)) {}
123
 
124
};
125
 
126
using boost::optional ;
127
 
128
optional< std::pair< NT, NT > >
129
  linsolve_pointC2() ;
130
 
131
optional< V > construct_normal_offset_lines_isecC2 ( )
132
{
133
  optional< std::pair > ip;
134
 
135
  ip = linsolve_pointC2();
136
 
137
  V a(ip->first) ;
138
  return a;
139
}
140
 
141
 
142
 

powered by: WebSVN 2.1.0

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