OSDN Git Service

* lib/g++-dg.exp (g++-dg-test): Add "repo" option.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.old-deja / g++.pt / instantiate11.C
1 // { dg-do assemble  }
2 // Origin: Neil Booth, from bug report #36
3
4 template <typename t> class vect;
5 template <typename t> vect<t> operator-( const vect<t>&, const vect<t>& );
6
7 template <typename t>
8 class vect
9 {
10 public:
11   vect( t a );
12
13   vect( const vect<t>& v );
14   ~vect();
15
16   vect<t>& operator=( const vect<t>& v );
17   vect<t>  operator-( void ) const;
18   friend vect<t> (::operator- <>)( const vect<t>&, const vect<t>& );
19
20 private:
21   t a_;
22 };
23
24 template <typename t> inline
25 vect<t>::vect( t a )
26 : a_(a)
27 {
28 }
29
30 template <typename t> inline
31 vect<t>::vect( const vect<t>& v )
32 : a_(v.a_)
33 {
34 }
35
36 template <typename t> inline
37 vect<t>::~vect()
38 {
39 }
40
41 template <typename t> inline vect<t>& 
42 vect<t>::operator=( const vect<t>& v )
43 {
44    a_ = v.a_;
45    return *this;
46 }
47
48 template <typename t> inline vect<t>
49 vect<t>::operator-( void ) const
50 {
51   return vect<t>( -a_ );
52 }
53
54 template <typename t> inline vect<t>
55 operator-( const vect<t>& u, const vect<t>& v )
56 {
57   return vect<t>( u.a_ - v.a_ );
58 }
59
60 int
61 main( void )
62 {
63   vect<double> a( 1.0 ), b( 0.0 );
64   b = -a;
65 }