The following program produces a variable scope warning, even when compiled
with -ffor-scope, preventing use of -Werror. The documentation only mentions
warnings being generated if the flag is not given.
int main()
{
int i;
{
for (int i = 0; i < 100; ++i);
return i;
}
}
g++ -ffor-scope -Werror -otest test.cpp
cc1plus.exe: warnings being treated as errors
test.cpp: In function 'int main()':
test.cpp:6: warning: name lookup of 'i' changed
test.cpp:3: warning: matches this 'i' under ISO standard rules
test.cpp:5: warning: matches this 'i' under old rules
--
Summary: For scope warning despite -ffor-scope
Product: gcc
Version: 4.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: gcc at david dot osborn dot name
GCC build triplet: i686-pc-mingw32
GCC host triplet: i686-pc-mingw32
GCC target triplet: i686-pc-mingw32
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33260