Re: strange situation

From: Masaharu Goto (gotom@hpyiddq.jpn.hp.com)
Date: Mon Aug 04 1997 - 03:27:38 MEST


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
> 



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