From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23598 invoked by alias); 30 Jan 2009 20:50:51 -0000 Received: (qmail 23573 invoked by uid 48); 30 Jan 2009 20:50:39 -0000 Date: Fri, 30 Jan 2009 20:50:00 -0000 Subject: [Bug c++/39045] New: Not inited referense. X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "alexey dot veselovsky at gmail dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-01/txt/msg03405.txt.bz2 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