This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Problem with gcc 4.0.1
- From: "Ernest L. Williams Jr." <ernesto at ornl dot gov>
- To: Paolo Bonzini <paolo dot bonzini at lu dot unisi dot ch>
- Cc: ernesto at ornl dot gov, GCC Development <gcc at gcc dot gnu dot org>
- Date: Wed, 21 Sep 2005 07:10:35 -0400
- Subject: Re: Problem with gcc 4.0.1
- References: <1127269231.5139.12.camel@localhost.localdomain><43311EFA.6020101@lu.unisi.ch>
- Reply-to: ernesto at ornl dot gov
On Wed, 2005-09-21 at 10:51 +0200, Paolo Bonzini wrote:
> Ernest L. Williams Jr. wrote:
> > Hi,
> >
> > The following code fragment is now causing problems under gcc 4.0.1
> > Everything is perfect under "gcc version 3.4.3"
> > Any recommended work-arounds?
> > ================= code fragment======================================
> > #ifndef __LOC_PV_FACTORY_H__
> > #define __LOC_PV_FACTORY_H__
> >
> > line 10 --> #include "pv_factory.h"
> > line 11 -->
> > line 12 --> class LOC_PV_Factory : public PV_Factory
> > line 13 --> {
> > line 14 --> public:
> > line 15 --> LOC_PV_Factory();
> > line 16 --> ~LOC_PV_Factory();
> > line 17 --> ProcessVariable *create(const char *PV_name);
> > line 18 --> private:
> > line 19 --> friend class LOC_ProcessVariable;
> > line 20 --> static void forget(LOC_ProcessVariable *pv);
> > line 21 --> };
>
> GCC was incorrectly accepting this code.
So is this a bug that is now fixed or is bad coding practices getting
caught with a stricter GCC distribution?
> You should add a declaration
> of class LOC_ProcessVariable outside class LOC_PV_Factory, either
> through its include file or with a forward declaration ("class
> LOC_ProcessVariable;").
Awesome. Now everything works for me.
>
> By the way, the correct list to ask would have been gcc-help@gcc.gnu.org
> (this one is for development "of" GCC, not "with" GCC).
>
Sounds good. I will subscribe to gcc-help@gcc.gnu.org
Thanks for your help and response,
Ernesto
> Paolo