gcc only warns on blah1 on the following code: const char *blah1() { char x = 7; return &x; }
const char *blah2() { char x = 7; static const char *names[1] = { &x }; return names[0]; } returnlocal.cc: In function 'const char* blah1()': returnlocal.cc:2: warning: address of local variable 'x' returned Shouldn't it warn on blah2 as well? Or is that asking too much? -- Summary: Missing warning on questionable use of parameter to initialize static Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dank at kegel dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24786