This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/24786] New: Missing warning on questionable use of parameter to initialize static
- From: "dank at kegel dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Nov 2005 06:28:14 -0000
- Subject: [Bug c++/24786] New: Missing warning on questionable use of parameter to initialize static
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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