Clean up some minor white space issues in trans-decl.c and trans-expr.c
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.martin / sts_vectini.C
blobb8ab3534a7d5c55d1bfa8a8868766b2ea2e08091
1 // { dg-do run  }
2 // { dg-options "-O2 -w" }
3 // egcs-bugs 1999-02-22 14:24 Stefan Schwarzer
4 // sts@ica1.uni-stuttgart.de
5 // optimizer problem in egcs <= 1.1.1
7 struct XTVec{
8   XTVec(){x[0]=x[1] =x[2] =0;}
9   XTVec(int ax,int y=0.,int z=0.){x[0]=ax;x[1]=y; x[2]=z; }
10   int& operator[](int);
12   int x[3];
15 inline 
16 int & XTVec::operator[](int i){
17   return x[i];
20 inline 
21 XTVec& operator+=(XTVec& lhs, XTVec& rhs){
22   lhs[0]+=rhs[0];
23   lhs[1]+=rhs[1];
24   lhs[2]+=rhs[2];
25   return lhs;
28 inline 
29 XTVec operator+(XTVec& lhs, XTVec& rhs){
30   XTVec result(lhs);
31   return result += rhs;
34 int main()
36   XTVec ur(4.,0.,1.);
37   XTVec ll(0.,2.,0.);
38   XTVec initsum(ur + ll);
40   // sum of components should be 7
41   return (initsum[0] + initsum[1] + initsum[2] - 7);