[Boost-bugs] [Boost C++ Libraries] #11640: scope_exit: -Wshadow warning issued

Subject: [Boost-bugs] [Boost C++ Libraries] #11640: scope_exit: -Wshadow warning issued
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-09-10 13:33:35


#11640: scope_exit: -Wshadow warning issued
-------------------------------+------------------------
 Reporter: lukasz.czajczyk@… | Owner: lcaminiti
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: scope_exit
  Version: Boost 1.58.0 | Severity: Problem
 Keywords: |
-------------------------------+------------------------
 Hi,
 BOOST_SCOPE_EXIT emits warning: declaration shadows a local variable
 [-Wshadow] in CLANG compiler.
 Tested with boost 1.54-1.58 and CLANG 3.5-3.7. The issue does not occur on
 GCC when boost is included using -isystem.

 Sample program:
 {{{
 #!div style="font-size: 80%"
 Code highlighting:
   {{{#!c++
 #include <boost/scope_exit.hpp>

 int main()
 {
    int i, j = 0;
    BOOST_SCOPE_EXIT(i, j)
    {} BOOST_SCOPE_EXIT_END
    return 0;
 }
   }}}
 }}}




 Compiled with clang++ -isystem /tmp/boost/boost_1_58_0 -Wshadow

  warning: declaration shadows a local variable [-Wshadow]
    BOOST_SCOPE_EXIT(i, j)
                     ^
 /tmp/boost/boost_1_58_0/boost/scope_exit.hpp:900:17: note: expanded from
 macro 'BOOST_SCOPE_EXIT'
                 __VA_ARGS__)
                 ^
 /tmp/boost/boost_1_58_0/boost/scope_exit.hpp:893:59: note: expanded from
 macro 'BOOST_SCOPE_EXIT_ID'
                         BOOST_SCOPE_EXIT_AUX_PP_VOID_LIST(__VA_ARGS__)))
                                                           ^
 /tmp/boost/boost_1_58_0/boost/scope_exit.hpp:178:59: note: expanded from
 macro 'BOOST_SCOPE_EXIT_AUX_PP_VOID_LIST'
             BOOST_SCOPE_EXIT_AUX_PP_KEYWORD_IS_VOID_BACK, __VA_ARGS__)
                                                           ^
 note: (skipping 66 expansions in backtrace; use -fmacro-backtrace-limit=0
 to see all)
 /tmp/boost/boost_1_58_0/boost/preprocessor/list/adt.hpp:35:63: note:
 expanded from macro 'BOOST_PP_LIST_FIRST_D'
 # define BOOST_PP_LIST_FIRST_D(list) BOOST_PP_LIST_FIRST_I list
                                                               ^
 /tmp/boost/boost_1_58_0/boost/preprocessor/list/adt.hpp:40:44: note:
 expanded from macro 'BOOST_PP_LIST_FIRST_I'
 # define BOOST_PP_LIST_FIRST_I(head, tail) head
                                            ^
 /tmp/boost/boost_1_58_0/boost/scope_exit.hpp:316:5: note: expanded from
 macro 'BOOST_SCOPE_EXIT_AUX_ARG_DECL'
     var
     ^
 p.cxx:5:8: note: previous declaration is here
    int i, j = 0;
        ^

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11640>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:19 UTC