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]

Follow up on static bug (is it a bug?)


To repeat...

I believe this is a bug in gcc 3.0
Forgive me if it's already known about...

The following code used to be valid ( <=2.95.3 ):

struct foo
{
        char field[25];

        static int getSize()
        {
                return(sizeof(field));
        }
};

 
Here it reports that in foo::getSize, foo::field cannot be referenced 
since it is non-static and foo::getSize is static, however the used of 
sizeof/typeof/etc should make it valid.  Is there something about ANSI 
C99 and the fact that arrays can have non-constant sizes or something?

...

Also, since then I've discovered that the following is also invalid

sizeof(foo::field)

... or ... 

(&foo::field)   <- which should give the offset of the field


This is invalid in any ole non-member function 



Thanks,
    -- Davy






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