CINT bug(s) continued

From: Jacek M. Holeczek (holeczek@us.edu.pl)
Date: Sat Apr 17 1999 - 16:05:12 MEST


Hi,
The attached macro ( trial2.cxx ) demonstrates the bug(s).
Proper "compiler" output :
--------------------------
donald duck
xx -> 1 *p_x -> 0
xyz->x(1)[0] = 10 -> 10
yy -> 2 *p_y -> 0
*xyz->y(2) -> 2
zz -> 3 *p_z -> 0
xyz->z(3)[0] = 30 -> 30
*p_y -> 2 -> 6
*xyz->y() = 5 -> 5
*p_y -> 5 -> 6
4 6 30
miki mouse
--------------------------
Wrong CINT output :
--------------------------
donald duck
Error: G__getvariable: expression [0] FILE:/home/holeczek/src/test/./t11.cxx LINE:27
Error: improper lvalue FILE:/home/holeczek/src/test/./t11.cxx LINE:27
(int)10
*** Interpreter error recovered ***
--------------------------
Even if I comment lines 27,28,29 I still get CINT errors :
--------------------------
donald duck
Error: Incorrect assignment to p_y  FILE:/home/holeczek/src/test/./t11.cxx LINE:11
Error: improper lvalue FILE:/home/holeczek/src/test/./t11.cxx LINE:32
*p_y -> 0(int)5
*** Interpreter error recovered ***
--------------------------
Seems that functions that return pointers are improperly parsed.
Jacek.


#include <stream.h>

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

  int *x() {return p_x;}
  //  int *y() {return p_y;}
  int *y() {cout << "*p_y -> " << *p_y ;*p_y=6;cout << " -> " << *p_y << endl;return p_y;}
  int *z() {return p_z;}

  XYZ() {return;}
  ~XYZ() {return;}
  int *x(int xx) {cout << "xx -> " << xx << " *p_x -> " << *p_x << endl;p_x[0]=xx;return p_x;}
  int *y(int yy) {cout << "yy -> " << yy << " *p_y -> " << *p_y << endl;p_y[0]=yy;return p_y;}
  int *z(int zz) {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