This is the mail archive of the gcc-bugs@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]

Re: g++ compile error


> Thanks for the reply.  Sorry if I assumed something from my posting.  
> Yes I completely searched every bug report I could find.  I even
> upgraded binutils-2.9.0.1.22 and egcs from 2.91.50 to 2.91.66 with hopes
> of succes.

Please follow the bug reporting instructions as close as possible the
next time, unless you are certain you know *exactly* what the problem
is.

> #include <stdlib.h>
> #include <stdio.h>
> #include <unistd.h>
> #include <errno.h>
> #include <time.h>
> #include <ctype.h>
> #include <sys/fcntl.h>

As instructed, these should have been preprocessed. In this particular
case, it was critical. Fortunately, I have a copy of the system you
are using.

> Disk::Disk(string iname, int imajor, int iminor) 
>         : name(iname),
>           major(imajor),
>           minor(iminor),
>           seen_activity(false)

I looked at the preprocessor output for this, and found

Disk::Disk(string iname, int imajor, int iminor) 
        : name(iname),
          ((int)((( imajor ) >> 8) & 0xff)) ,
          ((int)(( iminor ) & 0xff)) ,
          seen_activity(false)

See what happened? major is a macro, and after expansion, this isn't
C++ anymore. So g++ got confused. Upgrading the g++ version doesn't
help; renaming the class members does.

Hope this helps,
Martin


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