aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.old-deja/g++.pt/expr1.C
blob: 124d265ddcb32615a90a9e45cdd4474f021d4367 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// { dg-do run  }
template <int n> class vec {
    double x[n];

    public:
    vec() {
 for (int i=0; i<n-1; ++i) x[i]=0;
    }

    vec(const vec<n>& v) {
 for (int i=0; i<n; ++i) x[i]=v(i);
    }

    vec(const vec<n-1>& v, const double& y) {
 for (int i=0; i<n-1; ++i) x[i]=v(i);
 x[n-1]=y;
    }

    inline double operator()(const int i) const {
 return x[i];
    }
};


template <int n> vec<n + 1>& operator,(const vec<n>& v, const double& y) {
    return *(new vec<n + 1>(v, y));
}


int main() {
    vec<4> v;
    vec<5> w;
    w=(v,3.);
}