This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: const static initializers versionitis
- To: gianni at mariani dot ws (Gianni Mariani)
- Subject: Re: const static initializers versionitis
- From: Gianni Mariani <gianni_ at uluru dot mariani dot ws>
- Date: Tue, 22 Aug 2000 08:12:27 -0700 (PDT)
- Cc: gcc at gcc dot gnu dot org (gcc at gcc dot gnu dot org)
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;
}