CINT bug(s) continued ( 2 )

From: Jacek M. Holeczek (holeczek@us.edu.pl)
Date: Sun Apr 18 1999 - 17:17:08 MEST


Hi,
Many thanks for your reply.
Spliting the 'return p_x=xx;' is not a problem at all.
Problems with 'f()[0] = value;' are more serious.
> I'll think if those can be fixed, however, I can not put priority on fixing
When you think about it, could you also please think about the attached 
macro ( trial3.cxx ) where functions are 'strictly' declared.
Proper "compiler" output as from trial2.cxx, wrong CINT output :
--------------------------
root [0] .L t12.cxx
Warning: Undeclared data member x FILE:/home/holeczek/src/test/./t12.cxx LINE:9
*** Interpreter error recovered ***
--------------------------
Thanks in advance,
Jacek.


#include <stream.h>

class XYZ {
public:
  int p_x[10];
  int p_y[20];
  int p_z[30];

  int (&x())[10] {return p_x;}
  //  int *y() {return p_y;}
  int (&y())[20] {cout << "*p_y -> " << *p_y ;*p_y=6;cout << " -> " << *p_y << endl;return p_y;}
  int (&z())[30] {return p_z;}

  XYZ() {return;}
  ~XYZ() {return;}
  int (&x(int xx))[10] {cout << "xx -> " << xx << " *p_x -> " << *p_x << endl;p_x[0]=xx;return p_x;}
  int (&y(int yy))[20] {cout << "yy -> " << yy << " *p_y -> " << *p_y << endl;p_y[0]=yy;return p_y;}
  int (&z(int zz))[30] {cout << "zz -> " << zz << " *p_z -> " << *p_z << endl;p_z[0]=zz;return p_z;}
};

main()
{
  XYZ *xyz = new XYZ;

  cout << "donald duck" << endl;

  xyz->x(1)[0] = 10; cout << "xyz->x(1)[0] = 10 -> " << *xyz->p_x << endl;
  xyz->y(2); cout << "*xyz->y(2) -> " << *xyz->p_y << endl;
  xyz->z(3)[0] = 30; cout << "xyz->z(3)[0] = 30 -> " << *xyz->p_z << endl;

  xyz->x()[0] = 4;
  xyz->y()[0] = 5; cout << "*xyz->y() = 5 -> " << *xyz->p_y << endl;

  cout << *xyz->x() << " " << *xyz->y() << " " << *xyz->z() << endl;

  cout << "miki mouse" << endl;

}



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:31 MET