GCC with -Wshadow generates warnings
andreyv opened this issue · comments
prettyprint98.hpp
generates this with GCC 4.7 and -Wshadow
:
prettyprint98.hpp: In constructor 'pretty_print::custom_delims_wrapper<T, Delims>::custom_delims_wrapper(const T&)':
prettyprint98.hpp:241:44: warning: declaration of 't' shadows a member of 'this' [-Wshadow]
prettyprint98.hpp: In member function 'std::ostream& pretty_print::custom_delims_wrapper<T, Delims>::stream(std::ostream&)':
prettyprint98.hpp:244:9: warning: declaration of 'stream' shadows a member of 'this' [-Wshadow]
prettyprint98.hpp: In member function 'std::wostream& pretty_print::custom_delims_wrapper<T, Delims>::stream(std::wostream&)':
prettyprint98.hpp:248:9: warning: declaration of 'stream' shadows a member of 'this' [-Wshadow]
As -Wshadow
is a very useful warning and I would like my programs to be warning-free, I kindly ask to fix this :-)
Sure, that's easy to fix. Thanks for the tip!
On 11/06/2012 12:39, Andrey Vihrov wrote:
prettyprint98.hpp
generates this with GCC 4.7 and-Wshadow
:prettyprint98.hpp: In constructor 'pretty_print::custom_delims_wrapper<T, Delims>::custom_delims_wrapper(const T&)': prettyprint98.hpp:241:44: warning: declaration of 't' shadows a member of 'this' [-Wshadow] prettyprint98.hpp: In member function 'std::ostream& pretty_print::custom_delims_wrapper<T, Delims>::stream(std::ostream&)': prettyprint98.hpp:244:9: warning: declaration of 'stream' shadows a member of 'this' [-Wshadow] prettyprint98.hpp: In member function 'std::wostream& pretty_print::custom_delims_wrapper<T, Delims>::stream(std::wostream&)': prettyprint98.hpp:248:9: warning: declaration of 'stream' shadows a member of 'this' [-Wshadow]
As
-Wshadow
is a very useful warning and I would like my programs to be warning-free, I kindly ask to fix this :-)
Reply to this email directly or view it on GitHub:
#3
I believe I fixed that. Closing; and many thanks!
I believe there are some occurrences left in prettyprint.hpp
:
In file included from /home/andrey/olymp/local:8:0, from template.cpp:8: /home/andrey/olymp/prettyprint.hpp: In member function 'std::ostream& pretty_print::custom_delims_wrapper::stream(std::ostream&)': /home/andrey/olymp/prettyprint.hpp:248:9: warning: declaration of 'stream' shadows a member of 'this' [-Wshadow] { ^ /home/andrey/olymp/prettyprint.hpp: In member function 'std::wostream& pretty_print::custom_delims_wrapper::stream(std::wostream&)': /home/andrey/olymp/prettyprint.hpp:252:9: warning: declaration of 'stream' shadows a member of 'this' [-Wshadow] { ^
Thanks, let me check and fix that...
Fixed in commit a82568a. Thanks for reporting!