[Boost-bugs] [Boost C++ Libraries] #9633: BOOST_PP_SEQ_CAT with a sequence of comma separated pairs fails with gcc

Subject: [Boost-bugs] [Boost C++ Libraries] #9633: BOOST_PP_SEQ_CAT with a sequence of comma separated pairs fails with gcc
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-02-05 17:08:38


#9633: BOOST_PP_SEQ_CAT with a sequence of comma separated pairs fails with gcc
------------------------------+---------------------------
 Reporter: albertembedded@… | Owner: no-maintainer
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: preprocessor
  Version: Boost 1.55.0 | Severity: Problem
 Keywords: |
------------------------------+---------------------------
 Hi,

 Code with problem :

 {{{
 #include <boost\preprocessor\seq\cat.hpp>

 #define SOME_SEQUENCE (('a',1)) (('b',2)) (('c',3)) (('d',4)) (('e',5))

 struct dummy
 {
     dummy& operator()(char,int) {return *this;}
 };

 int main()
 {
     dummy() BOOST_PP_SEQ_CAT(SOME_SEQUENCE);

     return 0;
 }

 }}}

 Following code compiles with Visual 2010. (generates dummy()
 ('a',1)('b',2)('c',3)('d',4)('e',5);)

 With gcc, it does not compil.

 I have a collection of compilation error :

 main.cpp:3:30: error: pasting ")" and "(" does not give a valid
 preprocessing token

 preprocessor\seq\cat.hpp:35:37: note: in definition of macro
 'BOOST_PP_SEQ_CAT_O_I'

 preprocessor/seq/fold_left.hpp:555:144: note: in expansion of macro
 'BOOST_PP_SEQ_CAT_O'

 and so on



 By gcc, I mean TDM MinGW32 (from tdm-gcc-4.8.1-3.exe)

 Tried with following options :
 {{{
 mingw32-g++.exe -std=c++0x -g -IC:\boost_1_55_0 -c
 "C:\sources\main.cpp" -o obj\main.o
 mingw32-g++.exe -std=c++1y -g -IC:\boost_1_55_0 -c
 "C:\sources\main.cpp" -o obj\main.o
 mingw32-g++.exe -g -IC:\boost_1_55_0 -c "C:\sources\main.cpp" -o
 obj\main.o

 }}}


 Notice that following code compiles fine which can be used as a workaround
 :

 Code compiling :
 {{{
 #include <boost\preprocessor\seq\for_each.hpp>

 #define SOME_SEQUENCE (('a',1)) (('b',2)) (('c',3)) (('d',4)) (('e',5))

 #define MACRO_FOR_EACH(r,data,e)\
     e

 struct dummy
 {
     dummy& operator()(char,int) {return *this;}
 };

 int main()
 {
     dummy() BOOST_PP_SEQ_FOR_EACH(MACRO_FOR_EACH,_,SOME_SEQUENCE);

     return 0;
 }

 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/9633>
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