Opened 6 years ago
Last modified 6 years ago
#12426 new Bugs
boost/preprocessor/seq/for_each_i.hpp fails on gcc 5.4.0 and appleclang 7.3.0
Reported by: | Owned by: | No-Maintainer | |
---|---|---|---|
Milestone: | To Be Determined | Component: | preprocessor |
Version: | Boost 1.58.0 | Severity: | Problem |
Keywords: | Cc: |
Description
I have attached test1.cpp which can be compiled with:
g++ -Wall -Wextra -Werror -g -O0 -save-temps -o test1.o -c -fpic test1.cpp
There appears to be more than 1 problem, but this at least shows that BOOST_PP_SEQ_FOR_EACH_I is broken when using these compilers (the string should not be present in the output, but is, with these compilers). Just check the test1.ii file to observe this.
Attachments (1)
Change History (2)
by , 6 years ago
comment:1 by , 6 years ago
The diff below solves the problem, by bringing the code for the arity 0 case back to the state it was in at version 1.48 (when compared to 1.58):
--- /usr/include/boost/preprocessor/tuple/to_seq.hpp 2016-09-20 13:34:52.926120462 -0700 +++ /usr/include/boost/preprocessor/tuple/to_seq.hpp 2016-09-20 13:35:02.516377864 -0700 @@ -49,7 +49,7 @@ # endif # /* An empty array can be passed */ -# define BOOST_PP_TUPLE_TO_SEQ_0() () +# define BOOST_PP_TUPLE_TO_SEQ_0() # # define BOOST_PP_TUPLE_TO_SEQ_1(e0) (e0) # define BOOST_PP_TUPLE_TO_SEQ_2(e0, e1) (e0)(e1)
To avoid this bug in BOOST_PP_TUPLE_TO_SEQ I used the work-around below:
#include <boost/preprocessor/list/for_each.hpp> #include <boost/preprocessor/tuple/to_list.hpp> #define TUPLE_TO_SEQ_E(r, data, elem) (elem) #define TUPLE_TO_SEQ(I, T) \ BOOST_PP_LIST_FOR_EACH(TUPLE_TO_SEQ_E, _, BOOST_PP_TUPLE_TO_LIST(I, T))
Note:
See TracTickets
for help on using tickets.
Example code