Re: strange situation

Masaharu Goto (gotom@hpyiddq.jpn.hp.com)
Mon, 04 Aug 1997 10:27:38 JST


Yuri,

This was a cint bug and I fixed it in 5.13.20. This happens only when
const inline member function is used for initialization of a variable.
^^1^^ ^^2^^^ ^^^^^^^^^^^^^^3^^^^^^^^^^^^^
Problem can be avoided, for the time being, if either one of above 3
condition is removed. In other words, doing one of following change
will give you work arounds.

1. int f(int j) const {return j;} => int f(int j) { return j;}
2. int f(int j) const {return j;} => int f(int j) const;}; int X::f(int j)..
3. int n=a.f(i); => int n; n=a.f(i);

Thanks for your bug report.
Masaharu Goto

> Dear ROOTers !
>
> I have run into the strange situation. The skeleton macro below
> did't work rightly ( the diagnostics was : "Changing const n ..." ).
>
> #include <iostream.h>
>
> class X {
> public:
> int f(int j) const {return j;}
> };
>
> void main() {
> X a;
> for (int i=0; i<3; i++) {
> int n=a.f(i);
> switch (n) {
> case 0: cout<<n<<endl; break;
> case 1: cout<<n<<endl; break;
> case 2: cout<<n<<endl; break;
> }
> }
> }
>
> Meanwhile, the next modification worked fine ( member function f is not
> constant now ).
>
> #include <iostream.h>
>
> class X {
> public:
> int f(int j) /*const*/ {return j;}
> };
>
> void main() {
> X a;
> for (int i=0; i<3; i++) {
> int n=a.f(i);
> switch (n) {
> case 0: cout<<n<<endl; break;
> case 1: cout<<n<<endl; break;
> case 2: cout<<n<<endl; break;
> }
> }
> }
>
>
> Help me please !
> My system configuration is
> Linux 2.0.27
> ROOT 1.02/00
> CINT 5.13.17
>
> Yuri Belikov
>