This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Illegal use of uninitialized reference, improperly allowed
- To: "gcc-bugs at gcc dot gnu dot org" <gcc-bugs at gcc dot gnu dot org>
- Subject: Illegal use of uninitialized reference, improperly allowed
- From: "Philippe A. Bouchard" <phiilppeb at corel dot com>
- Date: Thu, 14 Sep 2000 15:29:27 -0700
#include <iostream>
struct A
{
int & a, & b;
A():a(b), b(* new int(1)) {};
};
int main(...)
{
A a;
cout << & a.a << ", " << & a.b << endl;
}
a.a will be NULL in this case. Shouldn't the compiler notice the
reference to A::b, which is not initialized yet?
Version:
gcc version egcs-2.91.66 Debian GNU/Linux (egcs-1.1.2 release)
Thank you.