This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: error when porting from g++ for hp-ux to g++ for linux
- From: Ian Lance Taylor <iant at google dot com>
- To: "Puetz, Oliver P11M22" <Puetz dot Oliver at siemens dot com>
- Cc: <gcc at gcc dot gnu dot org>
- Date: 12 Jan 2007 07:10:32 -0800
- Subject: Re: error when porting from g++ for hp-ux to g++ for linux
- References: <EC540739CB7FB34E94B4ADAEAD727467714CAA@DBGR1EMA.ww007.siemens.net>
"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