This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/39045] New: Not inited referense.
- From: "alexey dot veselovsky at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 Jan 2009 20:50:39 -0000
- Subject: [Bug c++/39045] New: Not inited referense.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
g++ allows to exist not inited reference in this case:
struct X
{
int &x;
};
int main()
{
X* p_x = new X; // now there is not inited reference (p_x->x)
// now we can try to use p_x->x
std::cout << p_x->x << std::endl; // segmentation fault
return 0;
}
There are no errors or warnings. Compilation is successfull.
I have tested on g++ (GCC) 4.2.4 (Ubuntu 4.2.4-1ubuntu3).
Also it "works" on g++ 4.3.
--
Summary: Not inited referense.
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: alexey dot veselovsky at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39045