repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Skip analyzer strndup test on hppa*-*-hpux*
[official-gcc.git]
/
gcc
/
testsuite
/
g++.old-deja
/
g++.brendan
/
template5.C
blob
1b68043a35c36178df087b27b6ccdde18c4e2e07
1
// { dg-do assemble }
2
// GROUPS passed templates
3
template<class T>
4
class Vector
5
{
6
public:
7
Vector(int x);
8
~Vector();
9
T& operator [] (int i);
10
11
private:
12
T* v;
13
int sz;
14
} ;
15
16
template<class T>
17
Vector<T>::Vector(int x)
18
{
19
sz = x;
20
v = new T (sz);
21
}
22
23
template<class T>
24
Vector<T>::~Vector()
25
{ delete [] v; }
26
27
template<class T>
28
T &
29
Vector<T>::operator [] (int i)
30
{ return v[i]; }
31
32
int
33
main(int, char **)
34
{
35
Vector<int> intvec(3);
36
37
intvec[0] = 1;
38
intvec[1] = 2;
39
intvec[2] = 3;
40
41
for (int i = 0; i < 3; i++)
42
intvec[i];
43
44
return 0;
45
}
46
47
48