Re: [Boost-bugs] [Boost C++ Libraries] #5522: [foreach] Warning with gcc-4.6.0 and -Wconversion

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #5522: [foreach] Warning with gcc-4.6.0 and -Wconversion
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-02-18 20:39:43


#5522: [foreach] Warning with gcc-4.6.0 and -Wconversion
--------------------------------------+--------------------------
  Reporter: sefi@… | Owner: eric_niebler
      Type: Bugs | Status: closed
 Milestone: To Be Determined | Component: foreach
   Version: Boost Development Trunk | Severity: Problem
Resolution: wontfix | Keywords:
--------------------------------------+--------------------------

Comment (by anonymous):

 For what it's worth, I found a workaround this way. I'm assuming the
 compiler will optimize out the v__LINE__ variables. The __LINE__
 concatenation is required if you have multiple FOREACH calls with\in the
 same scope.


 {{{
 #if defined(__GNUC__)
 #define M_FOREACH(elem, vec) M_FOREACH_W_LINE(elem,vec,__LINE__)
 #define M_FOREACH_W_LINE(elem, vec, n) M_FOREACH_CONCAT_VAR(elem, vec, n)
 #define M_FOREACH_CONCAT_VAR(elem, vec, n) \
         __typeof__(vec) v ## n = vec; \
         BOOST_FOREACH(elem, v ## n)

 #else
 #define M_FOREACH(elem, vec) \
         BOOST_FOREACH(elem, vec)
 #endif
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5522#comment:3>
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:15 UTC