id summary reporter owner description type status milestone component version severity resolution keywords cc 2329 GCC preprocessing error rtelyuk@… No-Maintainer "#include ""boost/preprocessor.hpp"" #define _NOP() #define _UL() _ #define _SC() ; #define CLASS( name ) class name #define STRUCT( name ) struct name #define _PUBLIC() public #define _PRIVATE() private #define _PROTECTED() protected #define DECLARE_MEMBER(r, d, mem) \ BOOST_PP_TUPLE_ELEM(2, 0, mem) BOOST_PP_TUPLE_ELEM(2, 1, mem) _SC() #define DECLARE_ARG_CONSTRUCT(r, d, arg) \ BOOST_PP_TUPLE_ELEM(2, 0, arg) BOOST_PP_TUPLE_ELEM(2, 1, arg)_UL() BOOST_PP_EXPR_IF(BOOST_PP_LESS_EQUAL(r,d), BOOST_PP_COMMA()) #define DECLARE_ARG_CONSTRUCT_INIT(r, d, arg) \ BOOST_PP_TUPLE_ELEM(2, 1, arg) ( BOOST_PP_TUPLE_ELEM(2, 1, arg)_UL() ) BOOST_PP_EXPR_IF(BOOST_PP_LESS_EQUAL(r,d), BOOST_PP_COMMA()) #define DECLARE_T( lang_type, name, memeber_seq, member_access ) \ lang_type(name) { \ name ( \ BOOST_PP_SEQ_FOR_EACH( DECLARE_ARG_CONSTRUCT, BOOST_PP_SEQ_SIZE(memeber_seq), memeber_seq ) \ ) : \ BOOST_PP_SEQ_FOR_EACH( DECLARE_ARG_CONSTRUCT_INIT, BOOST_PP_SEQ_SIZE(memeber_seq), memeber_seq ) \ {} \ member_access##: \ BOOST_PP_SEQ_FOR_EACH( DECLARE_MEMBER , _NOP(), memeber_seq) \ }; #define DEF_TN( t,n ) ((t,n)) Use in code: DECLARE_T( STRUCT, some, DEF_TN(int, a) DEF_TN(int, b) DEF_TN(int, c), _PUBLIC() ) Two compilers MSVC++ 2005 for Win platform and XCode 3.0 GCC for MacOSX platform Result: MSVC++ 2005 /W4 ― preprocessing succeful: struct some { some ( int a_ , int b_ , int c_ ) : a ( a_ ) , b ( b_ ) , c ( c_ ) {} public: int a ; int b ; int c ; }; XCode GCC ― error: macro ""BOOST_PP_EXPR_IIF"" passed 3 arguments, but takes just 2" Bugs closed Boost 1.37.0 preprocessor Boost 1.36.0 Problem invalid