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

Subversion Repositories openrisc

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

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

Line No. Rev Author Line
1 693 jeremybenn
/* { dg-do compile } */
2
 
3
template < typename > class basic_stringstream;
4
 
5
struct basic_string {
6
  basic_string();
7
};
8
 
9
struct ios_base {
10
  virtual ~ios_base();
11
};
12
 
13
class ostream:ios_base {};
14
class istream:virtual ios_base {};
15
 
16
template < typename > struct basic_iostream:public istream, ostream {
17
  ~basic_iostream () {}
18
};
19
extern template class basic_iostream < char >;
20
 
21
template < typename > struct basic_stringstream:public basic_iostream < char > {
22
    basic_string _M_stringbuf;
23
    ~basic_stringstream () {}
24
};
25
extern template class basic_stringstream < char >;
26
 
27
template < typename > struct AnyMatrixBase;
28
template < typename, int _Rows, int _Cols, int = _Rows, int = _Cols > class Matrix;
29
template < typename > class CwiseNullaryOp;
30
 
31
template < typename Derived > struct MatrixBase:public AnyMatrixBase < Derived > {
32
  typedef CwiseNullaryOp < Derived > ConstantReturnType;
33
  ConstantReturnType Constant ();
34
  template < typename > Derived cast ();
35
  static CwiseNullaryOp < Derived > Random (int);
36
};
37
 
38
template < typename Derived > struct AnyMatrixBase {
39
  Derived derived () {}
40
  Derived & derived () const {}
41
};
42
 
43
template < typename, int > struct ei_matrix_storage {};
44
 
45
template < typename _Scalar, int, int, int _MaxRows, int _MaxCols > struct Matrix:MatrixBase < Matrix < _Scalar, _MaxRows, _MaxCols > > {
46
  typedef MatrixBase < Matrix > Base;
47
  ei_matrix_storage < int, _MaxCols > m_storage;
48
  Matrix operator= (const Matrix other) {
49
    _resize_to_match (other);
50
    lazyAssign (other.derived ());
51
  }
52
  template < typename OtherDerived > Matrix lazyAssign (MatrixBase < OtherDerived > other) {
53
    _resize_to_match (other);
54
    return Base (other.derived ());
55
  }
56
  Matrix ();
57
  template < typename OtherDerived > Matrix (const MatrixBase < OtherDerived > &other) {
58
    *this = other;
59
  }
60
  template < typename OtherDerived > void _resize_to_match (const MatrixBase < OtherDerived > &) {
61
    throw 1;
62
  }
63
};
64
 
65
template < typename MatrixType > class CwiseNullaryOp:
66
public MatrixBase < CwiseNullaryOp < MatrixType > > {};
67
 
68
int f()
69
{
70
  bool align_cols;
71
  if (align_cols) {
72
    basic_stringstream sstr;
73
    f();
74
  }
75
}
76
 
77
template < typename > struct AutoDiffScalar;
78
template < typename Functor > struct AutoDiffJacobian:Functor {
79
  AutoDiffJacobian (Functor);
80
  typedef typename Functor::InputType InputType;
81
  typedef typename Functor::ValueType ValueType;
82
  typedef Matrix < int, Functor::InputsAtCompileTime, 1 > DerivativeType;
83
  typedef AutoDiffScalar < DerivativeType > ActiveScalar;
84
  typedef Matrix < ActiveScalar, Functor::InputsAtCompileTime, 1 > ActiveInput;
85
  void operator () (InputType x, ValueType *) {
86
    ActiveInput ax = x.template cast < ActiveScalar > ();
87
  }
88
};
89
 
90
template < int NX, int NY > struct TestFunc1 {
91
  enum  {
92
    InputsAtCompileTime = NX
93
  };
94
  typedef Matrix < float, NX, 1 > InputType;
95
  typedef Matrix < float, NY, 1 > ValueType;
96
  typedef Matrix < float, NY, NX > JacobianType;
97
  int inputs ();
98
};
99
 
100
template < typename Func > void forward_jacobian (Func f) {
101
  typename Func::InputType x = Func::InputType::Random (f.inputs ());
102
  typename Func::ValueType y;
103
  typename Func::JacobianType jref = jref.Constant ();
104
  AutoDiffJacobian < Func > autoj (f);
105
  autoj (x, &y);
106
}
107
 
108
void test_autodiff_scalar ()
109
{
110
  forward_jacobian (TestFunc1 < 2, 2 > ());
111
  forward_jacobian (TestFunc1 < 3, 2 > ());
112
}

powered by: WebSVN 2.1.0

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