Message-Id: <199803201620.SAA112658@ieva06.lanet.lv> From: "Andris Pavenis" To: djgpp AT delorie DOT com, Sebastien BROCHET Date: Fri, 20 Mar 1998 18:17:18 +0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: Limititation with DJGPP, scope problem ... In-reply-to: <3512731B.EA2518A1@geocities.com> Precedence: bulk > From: Sebastien BROCHET > Subject: Limititation with DJGPP, scope problem ... > Hi all, > I don't see any problem with code except missing ';' after class definitions. > I think I've come into a limitation in the use of DJGPP. > Although this limitation can be avoided , hopefully !, it is still a bit > annoying. > > Let's have a class A: > class A > { > public: > A(void) {} > virtual ~A(void) {} > > virtual void Set(int Value) {} > } > > And a class B: > class B > { > public: > B(void) {} > virtual ~B(void) {} > > virtual void Raise(int Value) { m_pA->Set(Value); } // Pb with DJGPP * > > protected: > A *m_pA; > } > > This snippet compiles well with BC3.0/3.1 and watcom 10.x > I think the code above compiles well with DJGPP too but in my project > there are a few more classes with some dependencies ... > And DJGPP complains something like that : > "Lookup in the scope 'class A' does not match lookup in the current > scope" > in the line (*) : m_pA->Set(Value); // method B::Raise > If I put missing ';' after class definitions class A { .... }; and remove garbage text between classes (better use comments inside code snippets) then both classes compiles OK for me with all versions of GCC I was able to test (2.7.2.1, 2.8.0, 2.8.1, egcs 1.01). So there is no problem with it. > I can work around by writing : > int i = Value; > m_pA->Set(i); > > and it compiles well. > Workaround is not neaded. It compiles OK also without it (at least for me) Andris Pavenis