g++ 2.95.2 bug

Dima Volodin dvv@egcs.dvv.ru
Fri Dec 31 20:54:00 GMT 1999


On Sun, 19 Dec 1999 23:19:21 -0700, Martin Sebor wrote:

>$ cat t.cc
>
>inline void* operator new (unsigned, void *p) { return p; }
>
>struct A {
>    A () { }
>};
>
>struct B {
>    B ();
>};
>
>B b;   // should be dynamically initialized (i.e., after `a')
>
>char c[sizeof (A)];
>A &a = (A&)*c;   // should be statically initialized

Why? A reference is not a POD type.

>
>A *ap;
>
>B::B () { ap = &a; }
>
>
>int main ()
>{
>    return !(ap != 0);   // should return 0 on success
>}
>



More information about the Gcc-bugs mailing list