Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCC with -Wshadow generates warnings #3

Closed
andreyv opened this issue Jun 11, 2012 · 5 comments
Closed

GCC with -Wshadow generates warnings #3

andreyv opened this issue Jun 11, 2012 · 5 comments

Comments

@andreyv
Copy link

andreyv commented Jun 11, 2012

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 :-)

@louisdx
Copy link
Owner

louisdx commented Jun 11, 2012

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

@louisdx
Copy link
Owner

louisdx commented Jan 28, 2013

I believe I fixed that. Closing; and many thanks!

@louisdx louisdx closed this as completed Jan 28, 2013
@andreyv
Copy link
Author

andreyv commented Aug 27, 2013

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]
         {
         ^

@louisdx
Copy link
Owner

louisdx commented Sep 2, 2013

Thanks, let me check and fix that...

@louisdx louisdx reopened this Sep 2, 2013
@louisdx
Copy link
Owner

louisdx commented Aug 11, 2014

Fixed in commit a82568a. Thanks for reporting!

@louisdx louisdx closed this as completed Aug 11, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants