public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/39045]  New: Not inited referense.
@ 2009-01-30 20:50 alexey dot veselovsky at gmail dot com
  2009-02-01  5:18 ` [Bug c++/39045] No warning for uninitialized reference bangerth at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: alexey dot veselovsky at gmail dot com @ 2009-01-30 20:50 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 6+ messages in thread
[parent not found: <bug-39045-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2011-09-29 22:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-30 20:50 [Bug c++/39045] New: Not inited referense alexey dot veselovsky at gmail dot com
2009-02-01  5:18 ` [Bug c++/39045] No warning for uninitialized reference bangerth at gmail dot com
2009-02-01  9:17 ` alexey dot veselovsky at gmail dot com
2009-02-06  2:42 ` [Bug c++/39045] uninitialized reference in struct with operator new is not erroring out pinskia at gcc dot gnu dot org
2009-04-29 15:35 ` pinskia at gcc dot gnu dot org
     [not found] <bug-39045-4@http.gcc.gnu.org/bugzilla/>
2011-09-29 23:07 ` paolo.carlini at oracle dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).