Subject: [Boost-bugs] [Boost C++ Libraries] #6616: boost preprocessor bug in 1.49
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-02-25 18:06:25
#6616: boost preprocessor bug in 1.49
------------------------------+---------------------------------------------
Reporter: sni4ok@⦠| Owner: no-maintainer
Type: Bugs | Status: new
Milestone: To Be Determined | Component: preprocessor
Version: Boost 1.49.0 | Severity: Problem
Keywords: |
------------------------------+---------------------------------------------
this example work incorrect with boost 1.49 on g++ 4.61 with compile flags
-std=gnu++0x[[BR]]
[[BR]]
#define WRITE_TEST_VALUE(r, data, num, name) std::cout << ", num: " << num
<< ", name: " << BOOST_PP_STRINGIZE(name);[[BR]]
#define ON_FOREACH_ARGS(ArgsArray, Functor) \[[BR]]
BOOST_PP_LIST_FOR_EACH_I(Functor, , \[[BR]]
BOOST_PP_TUPLE_TO_LIST(BOOST_PP_ARRAY_SIZE(ArgsArray),
BOOST_PP_ARRAY_DATA(ArgsArray)))[[BR]]
#define TEST_PP_LIST_FOREACH(ArgsArray) \[[BR]]
std::cout << " sz: " << BOOST_PP_ARRAY_SIZE(ArgsArray); \[[BR]]
ON_FOREACH_ARGS(ArgsArray, WRITE_TEST_VALUE)[[BR]]
#include <iostream>[[BR]]
#include <boost/preprocessor/list.hpp>[[BR]]
#include <boost/preprocessor/tuple.hpp>[[BR]]
#include <boost/preprocessor/array.hpp>[[BR]]
#include <boost/preprocessor/stringize.hpp>[[BR]]
[[BR]]
int main()[[BR]]
{[[BR]]
std::cout << "0:" << std::endl;[[BR]]
TEST_PP_LIST_FOREACH((0, ()))[[BR]]
std::cout << std::endl << "1:" << std::endl;[[BR]]
TEST_PP_LIST_FOREACH((1, (bla)))[[BR]]
std::cout << std::endl << "2:" << std::endl;[[BR]]
TEST_PP_LIST_FOREACH((2, (nu, bla)))[[BR]]
std::cout << std::endl;[[BR]]
return 0;[[BR]]
}[[BR]]
[[BR]]
output:[[BR]]
g++ test_pp.cpp -I/home/snike/boost/boost_1_49_0[[BR]]
./a.out[[BR]]
0:[[BR]]
sz: 0[[BR]]
1:[[BR]]
sz: 1, num: 0, name: bla[[BR]]
2:[[BR]]
sz: 2, num: 0, name: nu, num: 1, name: bla[[BR]]
[[BR]]
output2:[[BR]]
g++ test_pp.cpp -I/home/snike/boost/boost_1_49_0 -std=gnu++0x[[BR]]
./a.out[[BR]]
0:[[BR]]
sz: 0, num: 0, name:[[BR]]
1:[[BR]]
sz: 1, num: 0, name: bla[[BR]]
2:[[BR]]
sz: 2, num: 0, name: nu, num: 1, name: bla[[BR]]
[[BR]]
on boost 1.48 this example work correctly
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/6616> 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:09 UTC