[Bug c++/39045] New: Not inited referense.

2009-01-30 Thread alexey dot veselovsky at gmail dot com
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



[Bug c++/39045] No warning for uninitialized reference

2009-02-01 Thread alexey dot veselovsky at gmail dot com


--- Comment #2 from alexey dot veselovsky at gmail dot com  2009-02-01 
09:17 ---
I think it should be error, not warning. (comeau and ms vc claims it as error)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39045