Menu

#2 Squish warning about shadowed variable in GCC 4.1.2 (CentOS 5)

Unstable_(example)
closed-accepted
nobody
None
5
2019-02-14
2018-11-08
No

Some old GCCs complain about a parameter in an inner class's member function shadowing a variable of the same name in the function where that class is defined:

test_pstreams.cc: In constructor ‘main()::pguard::pguard(redi::ipstream&, int)’:
test_pstreams.cc:827: warning: declaration of ‘in’ shadows a previous local
test_pstreams.cc:802: warning: shadowed declaration is here

Since warnings are being treated as errors, the test program's build fails. The attached patch fixes it by renaming the inner class's ctor parameter.

About time I got to send you a patch, Jonathan. :)

1 Attachments

Discussion

  • Jonathan Wakely

    Jonathan Wakely - 2018-11-08

    Thanks! I think I'll rename it to something else, as I'm using a trailing underscore for member variables. Maybe "istrm" or something like that.

     
  • Jonathan Wakely

    Jonathan Wakely - 2019-02-14
    • status: open --> closed-accepted
     
  • Jonathan Wakely

    Jonathan Wakely - 2019-02-14

    Fixed in 625d4a5caa71e0256947711568fb1005831dddb9 - thanks

     

Log in to post a comment.