[Bug c++/48829] New: g++ no warning initializing a variable using itself

mfribeiro at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Apr 29 22:09:00 GMT 2011


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

           Summary: g++ no warning initializing a variable using itself
           Product: gcc
           Version: 4.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: mfribeiro@gmail.com


This code issues a warning:

g++ -Wall
int i = 5 + i;
warning: ‘i’ may be used uninitialized in this function

This code does not:
string s = string("str") + s;

Neither this:
string s(string("str") + s);

Shouldnt the 2 last ones issue warnings too?



More information about the Gcc-bugs mailing list