Hi,
The attached macro ( trial.cxx ) demonstrates the bug(s).
Proper "compiler" output :
--------------------------
donald duck
xx -> 1 p_x -> 0
xyz->x(1) = 10 -> 10
yy -> 2 p_y -> 0
xyz->y(2) -> 2
zz -> 3 p_z -> 0
xyz->z(3) = 30 -> 30
p_y -> 2 -> 6
xyz->y() = 5 -> 5
p_y -> 5 -> 6
4 6 30
miki mouse
--------------------------
Wrong CINT output :
--------------------------
donald duck
xx -> 1 p_x -> 0
xyz->x(1) = 10 -> 1 !!!
yy -> 2 p_y -> 0
xyz->y(2) -> 2
zz -> 3 p_z -> 0
xyz->z(3) = 30 -> 3 !!!
p_y -> 2 -> 6
xyz->y() = 5 -> 5
4 p_y -> 5 -> 6
6 3 !!!
miki mouse
--------------------------
Seems that functions that return references and have arguments are
improperly parsed.
Jacek.
#include <stream.h>
class XYZ {
public:
int p_x;
int p_y;
int p_z;
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;return p_x=xx;}
int y(int &yy) {cout << "yy -> " << yy << " p_y -> " << p_y << endl;return p_y=yy;}
int &z(int &zz) {cout << "zz -> " << zz << " p_z -> " << p_z << endl;return p_z=zz;}
};
main()
{
XYZ *xyz = new XYZ;
cout << "donald duck" << endl;
xyz->x(1) = 10; cout << "xyz->x(1) = 10 -> " << xyz->p_x << endl;
xyz->y(2); cout << "xyz->y(2) -> " << xyz->p_y << endl;
xyz->z(3) = 30; cout << "xyz->z(3) = 30 -> " << xyz->p_z << endl;
xyz->x() = 4;
xyz->y() = 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