This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: error when porting from g++ for hp-ux to g++ for linux


"Puetz, Oliver P11M22" <Puetz.Oliver@siemens.com> writes:

> here's a little sample code, which could be compiled with g++ 3.01 under
> hp-ux, but when compiled with g++ 3.4.6 under linux, following error
> occured: 
> 
> sample.c: In member function 'T C2<T>::PROC(T)': 
> sample.c:19: error: 'c1i' was not declared in this scope 

The question is not appropriate for the gcc@gcc.gnu.org mailing list.
It would be appropriate on the gcc-help@gcc.gnu.org mailing list.

The actual problem is happening because g++ 3.4.6 does a better job of
implementating the standard C++ language.  You are falling afoul of
the two-phase lookup rule.  The easiest fix is to change the line to
    T PROC(T x) { this->c1i = c2i; };

Further questions on this topic should be taken to a C++ standard FAQ.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]