This is the mail archive of the gcc@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: const static initializers versionitis



help - please ...

Why were forward declarations of const arrays removed from g++
since 2.95.2 ?

Isn't this a gcc bug ? i.e. not being able to forward declare an
array instance ?

The code still compiles fine in gcc so I would have some level
of expectation that "const"ness should not change the behaviour
of the compiler.

Is there a compiler switch that reinstates the desired behaviour ?

> 
> 
> The code below compiles fine with egcs-2.91.66 but fails with 2.95.2 and
> 
> 2.95.3 .   Am I missing somthing ?  Any way of getting the egcs-2.91.66
> behaviour in 2.95.3 ?
> 
> g++2.95.2 -c yy.cpp
> yy.cpp:7: uninitialized const `bar'
> yy.cpp:9: uninitialized const `tar'
> --------- yy.cpp -----------
struct foo {
        const struct foo * y;
        char    who[ 10 ];
};

const static struct foo bar[];

const static struct foo tar[];

const static struct foo bar[] = {
        tar, "bar"
};

const static struct foo tar[] = {
        bar, "tar"
};

const char * zefuc()
{
        return tar->y->who;
}





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