Boost logo

Boost :

Subject: Re: [boost] Any-Range containing transformed range fails when compiled with optimizations
From: Auer, Jens (jens.auer_at_[hidden])
Date: 2016-01-15 03:04:17


I've made some more investigations. I modified the program slightly to be able to compile it with older gcc and boost versions to see when it broke. Our project uses gcc 4.9.2 with boost 1.55, but when one of my colleagues compiled it on his local machine with gcc 5.2 and boost 1.59 we started to see the issues. The new version of the code is: #include <vector> #include <boost/range.hpp> #include <boost/range/any_range.hpp> #include <boost/range/adaptor/transformed.hpp> #include <iostream> template<typename T1, typename T2> void ASSERT_EQ(T1 x,T2 y) {assert(x == y);}; struct SourceEvent { std::uint32_t event; void* ptr; }; SourceEvent f(std::int32_t x) { return SourceEvent{0u, nullptr}; } int main() { using boost::adaptors::transformed; using R = boost::any_range<SourceEvent, boost::forward_traversal_tag, SourceEvent, std::ptrdiff_t>; std::vector<std::int32_t> v(100); R r = v | transformed( f ); auto t = v | transformed( f ); //ASSERT_EQ( 100u, boost::size(r) ); //ASSERT_EQ( 100u, boost::size(t) ); for (auto const& i: t) { ASSERT_EQ(0u, i.event ); ASSERT_EQ(nullptr, i.ptr); } for (auto const& i: r) { ASSERT_EQ(0u, i.event ); ASSERT_EQ(nullptr, i.ptr); } std::cout << "OK" << std::endl; return 0; } It fails with gcc 4.9.2 and boost 1.56: http://melpon.org/wandbox/permlink/IWuz9TfbdtJdcn45 Start prog.cc:15:28: warning: unused parameter 'x' [-Wunused-parameter] SourceEvent f(std::int32_t x) ^ prog.exe: prog.cc:7: void ASSERT_EQ(T1, T2) [with T1 = unsigned int; T2 = unsigned int]: Assertion `x == y' failed. Aborted Finish but works with boost 1.55 (altohugh it emits a ton of warnings): http://melpon.org/wandbox/permlink/vZNaxeCU7ncnH1NZ Start ... warnings removed ... OK 0 Finish So it looks like some change in boost-1.56 is causing this. Best wishes, Jens PS: The links are links to the wandbox online compiler with the examples. PPS: Here are the warnings generated with gcc 4.9.2 and boost 1.55: In file included from /usr/local/boost-1.55.0/include/boost/mpl/aux_/integral_wrapper.hpp:22:0, from /usr/local/boost-1.55.0/include/boost/mpl/int.hpp:20, from /usr/local/boost-1.55.0/include/boost/type_traits/detail/template_arity_spec.hpp:10, from /usr/local/boost-1.55.0/include/boost/type_traits/detail/bool_trait_def.hpp:14, from /usr/local/boost-1.55.0/include/boost/type_traits/is_volatile.hpp:40, from /usr/local/boost-1.55.0/include/boost/type_traits/remove_const.hpp:14, from /usr/local/boost-1.55.0/include/boost/range/const_iterator.hpp:25, from /usr/local/boost-1.55.0/include/boost/range/iterator.hpp:20, from /usr/local/boost-1.55.0/include/boost/range/begin.hpp:24, from /usr/local/boost-1.55.0/include/boost/range/functions.hpp:18, from /usr/local/boost-1.55.0/include/boost/range.hpp:26, from prog.cc:2: /usr/local/boost-1.55.0/include/boost/concept_check.hpp: In function 'void boost::function_requires(Model*)': /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:20: warning: typedef 'boost_concept_check45' locally defined but not used [-Wunused-local-typedefs] BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/preprocessor/cat.hpp:29:34: note: in definition of macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:7: note: in expansion of macro 'BOOST_PP_CAT' BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/concept/assert.hpp:44:5: note: in expansion of macro 'BOOST_CONCEPT_ASSERT_FN' BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens) ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp:45:7: note: in expansion of macro 'BOOST_CONCEPT_ASSERT' BOOST_CONCEPT_ASSERT((Model)); ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp: In destructor 'boost::AdaptableGenerator<Func, Return>::~AdaptableGenerator()': /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:20: warning: typedef 'boost_concept_check453' locally defined but not used [-Wunused-local-typedefs] BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/preprocessor/cat.hpp:29:34: note: in definition of macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:7: note: in expansion of macro 'BOOST_PP_CAT' BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/concept/assert.hpp:44:5: note: in expansion of macro 'BOOST_CONCEPT_ASSERT_FN' BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens) ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp:453:11: note: in expansion of macro 'BOOST_CONCEPT_ASSERT' BOOST_CONCEPT_ASSERT((Convertible<result_type, Return>)); ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp: In destructor 'boost::AdaptableUnaryFunction<Func, Return, Arg>::~AdaptableUnaryFunction()': /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:20: warning: typedef 'boost_concept_check465' locally defined but not used [-Wunused-local-typedefs] BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/preprocessor/cat.hpp:29:34: note: in definition of macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:7: note: in expansion of macro 'BOOST_PP_CAT' BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/concept/assert.hpp:44:5: note: in expansion of macro 'BOOST_CONCEPT_ASSERT_FN' BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens) ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp:465:11: note: in expansion of macro 'BOOST_CONCEPT_ASSERT' BOOST_CONCEPT_ASSERT((Convertible<result_type, Return>)); ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:20: warning: typedef 'boost_concept_check466' locally defined but not used [-Wunused-local-typedefs] BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/preprocessor/cat.hpp:29:34: note: in definition of macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:7: note: in expansion of macro 'BOOST_PP_CAT' BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/concept/assert.hpp:44:5: note: in expansion of macro 'BOOST_CONCEPT_ASSERT_FN' BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens) ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp:466:11: note: in expansion of macro 'BOOST_CONCEPT_ASSERT' BOOST_CONCEPT_ASSERT((Convertible<Arg, argument_type>)); ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp: In destructor 'boost::AdaptableBinaryFunction<Func, Return, First, Second>::~AdaptableBinaryFunction()': /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:20: warning: typedef 'boost_concept_check484' locally defined but not used [-Wunused-local-typedefs] BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/preprocessor/cat.hpp:29:34: note: in definition of macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:7: note: in expansion of macro 'BOOST_PP_CAT' BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/concept/assert.hpp:44:5: note: in expansion of macro 'BOOST_CONCEPT_ASSERT_FN' BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens) ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp:484:11: note: in expansion of macro 'BOOST_CONCEPT_ASSERT' BOOST_CONCEPT_ASSERT((Convertible<result_type, Return>)); ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:20: warning: typedef 'boost_concept_check485' locally defined but not used [-Wunused-local-typedefs] BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/preprocessor/cat.hpp:29:34: note: in definition of macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:7: note: in expansion of macro 'BOOST_PP_CAT' BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/concept/assert.hpp:44:5: note: in expansion of macro 'BOOST_CONCEPT_ASSERT_FN' BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens) ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp:485:11: note: in expansion of macro 'BOOST_CONCEPT_ASSERT' BOOST_CONCEPT_ASSERT((Convertible<First, first_argument_type>)); ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:20: warning: typedef 'boost_concept_check486' locally defined but not used [-Wunused-local-typedefs] BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/preprocessor/cat.hpp:29:34: note: in definition of macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:7: note: in expansion of macro 'BOOST_PP_CAT' BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/concept/assert.hpp:44:5: note: in expansion of macro 'BOOST_CONCEPT_ASSERT_FN' BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens) ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp:486:11: note: in expansion of macro 'BOOST_CONCEPT_ASSERT' BOOST_CONCEPT_ASSERT((Convertible<Second, second_argument_type>)); ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp: In destructor 'boost::InputIterator<TT>::~InputIterator()': /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:20: warning: typedef 'boost_concept_check517' locally defined but not used [-Wunused-local-typedefs] BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/preprocessor/cat.hpp:29:34: note: in definition of macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:7: note: in expansion of macro 'BOOST_PP_CAT' BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/concept/assert.hpp:44:5: note: in expansion of macro 'BOOST_CONCEPT_ASSERT_FN' BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens) ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp:517:9: note: in expansion of macro 'BOOST_CONCEPT_ASSERT' BOOST_CONCEPT_ASSERT((SignedInteger<difference_type>)); ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:20: warning: typedef 'boost_concept_check518' locally defined but not used [-Wunused-local-typedefs] BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/preprocessor/cat.hpp:29:34: note: in definition of macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:7: note: in expansion of macro 'BOOST_PP_CAT' BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/concept/assert.hpp:44:5: note: in expansion of macro 'BOOST_CONCEPT_ASSERT_FN' BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens) ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp:518:9: note: in expansion of macro 'BOOST_CONCEPT_ASSERT' BOOST_CONCEPT_ASSERT((Convertible<iterator_category, std::input_iterator_tag>)); ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp: In destructor 'boost::ForwardIterator<TT>::~ForwardIterator()': /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:20: warning: typedef 'boost_concept_check551' locally defined but not used [-Wunused-local-typedefs] BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/preprocessor/cat.hpp:29:34: note: in definition of macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:7: note: in expansion of macro 'BOOST_PP_CAT' BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/concept/assert.hpp:44:5: note: in expansion of macro 'BOOST_CONCEPT_ASSERT_FN' BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens) ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp:548:11: note: in expansion of macro 'BOOST_CONCEPT_ASSERT' BOOST_CONCEPT_ASSERT((Convertible< ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp: In destructor 'boost::BidirectionalIterator<TT>::~BidirectionalIterator()': /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:20: warning: typedef 'boost_concept_check579' locally defined but not used [-Wunused-local-typedefs] BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/preprocessor/cat.hpp:29:34: note: in definition of macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:7: note: in expansion of macro 'BOOST_PP_CAT' BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/concept/assert.hpp:44:5: note: in expansion of macro 'BOOST_CONCEPT_ASSERT_FN' BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens) ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp:576:11: note: in expansion of macro 'BOOST_CONCEPT_ASSERT' BOOST_CONCEPT_ASSERT((Convertible< ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp: In destructor 'boost::RandomAccessIterator<TT>::~RandomAccessIterator()': /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:20: warning: typedef 'boost_concept_check609' locally defined but not used [-Wunused-local-typedefs] BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/preprocessor/cat.hpp:29:34: note: in definition of macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:7: note: in expansion of macro 'BOOST_PP_CAT' BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/concept/assert.hpp:44:5: note: in expansion of macro 'BOOST_CONCEPT_ASSERT_FN' BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens) ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp:606:11: note: in expansion of macro 'BOOST_CONCEPT_ASSERT' BOOST_CONCEPT_ASSERT((Convertible< ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp: In destructor 'boost::Container<C>::~Container()': /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:20: warning: typedef 'boost_concept_check653' locally defined but not used [-Wunused-local-typedefs] BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/preprocessor/cat.hpp:29:34: note: in definition of macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:7: note: in expansion of macro 'BOOST_PP_CAT' BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/concept/assert.hpp:44:5: note: in expansion of macro 'BOOST_CONCEPT_ASSERT_FN' BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens) ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp:653:11: note: in expansion of macro 'BOOST_CONCEPT_ASSERT' BOOST_CONCEPT_ASSERT((InputIterator<const_iterator>)); ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp: In destructor 'boost::Mutable_Container<C>::~Mutable_Container()': /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:20: warning: typedef 'boost_concept_check681' locally defined but not used [-Wunused-local-typedefs] BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/preprocessor/cat.hpp:29:34: note: in definition of macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:7: note: in expansion of macro 'BOOST_PP_CAT' BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/concept/assert.hpp:44:5: note: in expansion of macro 'BOOST_CONCEPT_ASSERT_FN' BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens) ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp:680:11: note: in expansion of macro 'BOOST_CONCEPT_ASSERT' BOOST_CONCEPT_ASSERT(( ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:20: warning: typedef 'boost_concept_check683' locally defined but not used [-Wunused-local-typedefs] BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/preprocessor/cat.hpp:29:34: note: in definition of macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:7: note: in expansion of macro 'BOOST_PP_CAT' BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/concept/assert.hpp:44:5: note: in expansion of macro 'BOOST_CONCEPT_ASSERT_FN' BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens) ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp:683:11: note: in expansion of macro 'BOOST_CONCEPT_ASSERT' BOOST_CONCEPT_ASSERT((InputIterator<iterator>)); ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp: In destructor 'boost::ForwardContainer<C>::~ForwardContainer()': /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:20: warning: typedef 'boost_concept_check703' locally defined but not used [-Wunused-local-typedefs] BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/preprocessor/cat.hpp:29:34: note: in definition of macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:7: note: in expansion of macro 'BOOST_PP_CAT' BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/concept/assert.hpp:44:5: note: in expansion of macro 'BOOST_CONCEPT_ASSERT_FN' BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens) ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp:700:11: note: in expansion of macro 'BOOST_CONCEPT_ASSERT' BOOST_CONCEPT_ASSERT(( ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp: In destructor 'boost::Mutable_ForwardContainer<C>::~Mutable_ForwardContainer()': /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:20: warning: typedef 'boost_concept_check716' locally defined but not used [-Wunused-local-typedefs] BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/preprocessor/cat.hpp:29:34: note: in definition of macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:7: note: in expansion of macro 'BOOST_PP_CAT' BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/concept/assert.hpp:44:5: note: in expansion of macro 'BOOST_CONCEPT_ASSERT_FN' BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens) ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp:713:11: note: in expansion of macro 'BOOST_CONCEPT_ASSERT' BOOST_CONCEPT_ASSERT(( ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp: In destructor 'boost::ReversibleContainer<C>::~ReversibleContainer()': /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:20: warning: typedef 'boost_concept_check731' locally defined but not used [-Wunused-local-typedefs] BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/preprocessor/cat.hpp:29:34: note: in definition of macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:7: note: in expansion of macro 'BOOST_PP_CAT' BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/concept/assert.hpp:44:5: note: in expansion of macro 'BOOST_CONCEPT_ASSERT_FN' BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens) ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp:729:11: note: in expansion of macro 'BOOST_CONCEPT_ASSERT' BOOST_CONCEPT_ASSERT(( ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:20: warning: typedef 'boost_concept_check733' locally defined but not used [-Wunused-local-typedefs] BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/preprocessor/cat.hpp:29:34: note: in definition of macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:7: note: in expansion of macro 'BOOST_PP_CAT' BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/concept/assert.hpp:44:5: note: in expansion of macro 'BOOST_CONCEPT_ASSERT_FN' BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens) ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp:733:11: note: in expansion of macro 'BOOST_CONCEPT_ASSERT' BOOST_CONCEPT_ASSERT((BidirectionalIterator<const_reverse_iterator>)); ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp: In destructor 'boost::Mutable_ReversibleContainer<C>::~Mutable_ReversibleContainer()': /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:20: warning: typedef 'boost_concept_check755' locally defined but not used [-Wunused-local-typedefs] BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/preprocessor/cat.hpp:29:34: note: in definition of macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:7: note: in expansion of macro 'BOOST_PP_CAT' BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/concept/assert.hpp:44:5: note: in expansion of macro 'BOOST_CONCEPT_ASSERT_FN' BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens) ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp:755:11: note: in expansion of macro 'BOOST_CONCEPT_ASSERT' BOOST_CONCEPT_ASSERT((Mutable_BidirectionalIterator<iterator>)); ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:20: warning: typedef 'boost_concept_check756' locally defined but not used [-Wunused-local-typedefs] BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/preprocessor/cat.hpp:29:34: note: in definition of macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:7: note: in expansion of macro 'BOOST_PP_CAT' BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/concept/assert.hpp:44:5: note: in expansion of macro 'BOOST_CONCEPT_ASSERT_FN' BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens) ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp:756:11: note: in expansion of macro 'BOOST_CONCEPT_ASSERT' BOOST_CONCEPT_ASSERT((Mutable_BidirectionalIterator<reverse_iterator>)); ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp: In destructor 'boost::RandomAccessContainer<C>::~RandomAccessContainer()': /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:20: warning: typedef 'boost_concept_check776' locally defined but not used [-Wunused-local-typedefs] BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/preprocessor/cat.hpp:29:34: note: in definition of macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:7: note: in expansion of macro 'BOOST_PP_CAT' BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/concept/assert.hpp:44:5: note: in expansion of macro 'BOOST_CONCEPT_ASSERT_FN' BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens) ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp:773:11: note: in expansion of macro 'BOOST_CONCEPT_ASSERT' BOOST_CONCEPT_ASSERT(( ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp: In destructor 'boost::Mutable_RandomAccessContainer<C>::~Mutable_RandomAccessContainer()': /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:20: warning: typedef 'boost_concept_check800' locally defined but not used [-Wunused-local-typedefs] BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/preprocessor/cat.hpp:29:34: note: in definition of macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:7: note: in expansion of macro 'BOOST_PP_CAT' BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/concept/assert.hpp:44:5: note: in expansion of macro 'BOOST_CONCEPT_ASSERT_FN' BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens) ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp:800:11: note: in expansion of macro 'BOOST_CONCEPT_ASSERT' BOOST_CONCEPT_ASSERT((Mutable_RandomAccessIterator<typename self::iterator>)); ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:20: warning: typedef 'boost_concept_check801' locally defined but not used [-Wunused-local-typedefs] BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/preprocessor/cat.hpp:29:34: note: in definition of macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:7: note: in expansion of macro 'BOOST_PP_CAT' BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/concept/assert.hpp:44:5: note: in expansion of macro 'BOOST_CONCEPT_ASSERT_FN' BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens) ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp:801:11: note: in expansion of macro 'BOOST_CONCEPT_ASSERT' BOOST_CONCEPT_ASSERT((Mutable_RandomAccessIterator<typename self::reverse_iterator>)); ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp: In destructor 'boost::AssociativeContainer<C>::~AssociativeContainer()': /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:20: warning: typedef 'boost_concept_check905' locally defined but not used [-Wunused-local-typedefs] BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/preprocessor/cat.hpp:29:34: note: in definition of macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:7: note: in expansion of macro 'BOOST_PP_CAT' BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/concept/assert.hpp:44:5: note: in expansion of macro 'BOOST_CONCEPT_ASSERT_FN' BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens) ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp:905:11: note: in expansion of macro 'BOOST_CONCEPT_ASSERT' BOOST_CONCEPT_ASSERT((BinaryPredicate<key_compare,key_type,key_type>)); ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:20: warning: typedef 'boost_concept_check908' locally defined but not used [-Wunused-local-typedefs] BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/preprocessor/cat.hpp:29:34: note: in definition of macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:7: note: in expansion of macro 'BOOST_PP_CAT' BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/concept/assert.hpp:44:5: note: in expansion of macro 'BOOST_CONCEPT_ASSERT_FN' BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens) ^ /usr/local/boost-1.55.0/include/boost/concept_check.hpp:908:11: note: in expansion of macro 'BOOST_CONCEPT_ASSERT' BOOST_CONCEPT_ASSERT((BinaryPredicate<value_compare,value_type_,value_type_>)); ^ /usr/local/boost-1.55.0/include/boost/range/algorithm/equal.hpp: In function 'bool boost::range::equal(const SinglePassRange1&, const SinglePassRange2&)': /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:20: warning: typedef 'boost_concept_check172' locally defined but not used [-Wunused-local-typedefs] BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/preprocessor/cat.hpp:29:34: note: in definition of macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:7: note: in expansion of macro 'BOOST_PP_CAT' BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/concept/assert.hpp:44:5: note: in expansion of macro 'BOOST_CONCEPT_ASSERT_FN' BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens) ^ /usr/local/boost-1.55.0/include/boost/range/concepts.hpp:92:45: note: in expansion of macro 'BOOST_CONCEPT_ASSERT' #define BOOST_RANGE_CONCEPT_ASSERT( x ) BOOST_CONCEPT_ASSERT( x ) ^ /usr/local/boost-1.55.0/include/boost/range/algorithm/equal.hpp:172:13: note: in expansion of macro 'BOOST_RANGE_CONCEPT_ASSERT' BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> )); ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:20: warning: typedef 'boost_concept_check173' locally defined but not used [-Wunused-local-typedefs] BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/preprocessor/cat.hpp:29:34: note: in definition of macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:7: note: in expansion of macro 'BOOST_PP_CAT' BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/concept/assert.hpp:44:5: note: in expansion of macro 'BOOST_CONCEPT_ASSERT_FN' BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens) ^ /usr/local/boost-1.55.0/include/boost/range/concepts.hpp:92:45: note: in expansion of macro 'BOOST_CONCEPT_ASSERT' #define BOOST_RANGE_CONCEPT_ASSERT( x ) BOOST_CONCEPT_ASSERT( x ) ^ /usr/local/boost-1.55.0/include/boost/range/algorithm/equal.hpp:173:13: note: in expansion of macro 'BOOST_RANGE_CONCEPT_ASSERT' BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange2> )); ^ /usr/local/boost-1.55.0/include/boost/range/algorithm/equal.hpp: In function 'bool boost::range::equal(const SinglePassRange1&, const SinglePassRange2&, BinaryPredicate)': /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:20: warning: typedef 'boost_concept_check185' locally defined but not used [-Wunused-local-typedefs] BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/preprocessor/cat.hpp:29:34: note: in definition of macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:7: note: in expansion of macro 'BOOST_PP_CAT' BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/concept/assert.hpp:44:5: note: in expansion of macro 'BOOST_CONCEPT_ASSERT_FN' BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens) ^ /usr/local/boost-1.55.0/include/boost/range/concepts.hpp:92:45: note: in expansion of macro 'BOOST_CONCEPT_ASSERT' #define BOOST_RANGE_CONCEPT_ASSERT( x ) BOOST_CONCEPT_ASSERT( x ) ^ /usr/local/boost-1.55.0/include/boost/range/algorithm/equal.hpp:185:13: note: in expansion of macro 'BOOST_RANGE_CONCEPT_ASSERT' BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> )); ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:20: warning: typedef 'boost_concept_check186' locally defined but not used [-Wunused-local-typedefs] BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/preprocessor/cat.hpp:29:34: note: in definition of macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ /usr/local/boost-1.55.0/include/boost/concept/detail/general.hpp:71:7: note: in expansion of macro 'BOOST_PP_CAT' BOOST_PP_CAT(boost_concept_check,__LINE__) ^ /usr/local/boost-1.55.0/include/boost/concept/assert.hpp:44:5: note: in expansion of macro 'BOOST_CONCEPT_ASSERT_FN' BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens) ^ /usr/local/boost-1.55.0/include/boost/range/concepts.hpp:92:45: note: in expansion of macro 'BOOST_CONCEPT_ASSERT' #define BOOST_RANGE_CONCEPT_ASSERT( x ) BOOST_CONCEPT_ASSERT( x ) ^ /usr/local/boost-1.55.0/include/boost/range/algorithm/equal.hpp:186:13: note: in expansion of macro 'BOOST_RANGE_CONCEPT_ASSERT' BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange2> )); ^ prog.cc: At global scope: prog.cc:15:28: warning: unused parameter 'x' [-Wunused-parameter] SourceEvent f(std::int32_t x) -- Jens Auer | CGI | Software-Engineer CGI (Germany) GmbH & Co. KG Rheinstra?e 95 | 64295 Darmstadt | Germany T: +49 6151 36860 154 jens.auer_at_[hidden] Unsere Pflichtangaben gem?? ? 35a GmbHG / ?? 161, 125a HGB finden Sie unter de.cgi.com/pflichtangaben. CONFIDENTIALITY NOTICE: Proprietary/Confidential information belonging to CGI Group Inc. and its affiliates may be contained in this message. If you are not a recipient indicated or intended in this message (or responsible for delivery of this message to such person), or you think for any reason that this message may have been addressed to you in error, you may not use or copy or deliver this message to anyone else. In such case, you should destroy this message and are asked to notify the sender by reply e-mail. ________________________________________ Von: Boost [boost-bounces_at_[hidden]]&quot; im Auftrag von &quot;Auer, Jens [jens.auer_at_[hidden]] Gesendet: Freitag, 15. Januar 2016 07:07 An: boost_at_[hidden] Betreff: Re: [boost] Any-Range containing transformed range fails when compiled with optimizations I have just tested the same code clang 3.7. Here, everything compiles without warnings and works as expected. -- Jens Auer | CGI | Software-Engineer CGI (Germany) GmbH & Co. KG Rheinstra?e 95 | 64295 Darmstadt | Germany T: +49 6151 36860 154 jens.auer_at_[hidden] Unsere Pflichtangaben gem?? ? 35a GmbHG / ?? 161, 125a HGB finden Sie unter de.cgi.com/pflichtangaben. CONFIDENTIALITY NOTICE: Proprietary/Confidential information belonging to CGI Group Inc. and its affiliates may be contained in this message. If you are not a recipient indicated or intended in this message (or responsible for delivery of this message to such person), or you think for any reason that this message may have been addressed to you in error, you may not use or copy or deliver this message to anyone else. In such case, you should destroy this message and are asked to notify the sender by reply e-mail. ________________________________________ Von: Boost [boost-bounces_at_[hidden]]&quot; im Auftrag von &quot;Auer, Jens [jens.auer_at_[hidden]] Gesendet: Donnerstag, 14. Januar 2016 21:28 An: boost_at_[hidden] Betreff: [boost] Any-Range containing transformed range fails when compiled with optimizations Hi, I have a program which produces different results based on the compiler options. The program uses a boost::any_range containing a transformed range where the transformation function just returns a new object of a simple struct: #include <vector> #include <boost/range.hpp> #include <boost/range/any_range.hpp> #include <boost/range/adaptor/transformed.hpp> #include <iostream> template<typename T1, typename T2> void ASSERT_EQ(T1 x,T2 y) {assert(x == y);}; struct SourceEvent { std::uint32_t event; void* ptr; }; int main() { using boost::adaptors::transformed; using R = boost::any_range<SourceEvent, boost::forward_traversal_tag, SourceEvent, std::ptrdiff_t>; std::vector<std::int32_t> v(100); R r = v | transformed( [](auto const&) {return SourceEvent{0u, nullptr};} ); auto t = v | transformed( [](auto const&) {return SourceEvent{0u, nullptr};} ); ASSERT_EQ( 100u, boost::size(r) ); ASSERT_EQ( 100u, boost::size(t) ); for (auto const& i: t) { ASSERT_EQ(0u, i.event ); ASSERT_EQ(nullptr, i.ptr); } for (auto const& i: r) { ASSERT_EQ(0u, i.event ); ASSERT_EQ(nullptr, i.ptr); } std::cout << "OK" << std::endl; return 0; } When compiled without optimization, it just prints ok. The same source compiled with optimizations asserts, and prints some interesting warnings: In file included from /usr/local/boost-1.60.0/include/boost/range/detail/any_iterator.hpp:22:0, from /usr/local/boost-1.60.0/include/boost/range/any_range.hpp:17, from prog.cc:3: /usr/local/boost-1.60.0/include/boost/range/detail/any_iterator_wrapper.hpp: In member function 'boost::range_detail::any_forward_iterator_wrapper<WrappedIterator, Reference, Buffer>::reference boost::range_detail::any_forward_iterator_wrapper<WrappedIterator, Reference, Buffer>::dereference() const [with WrappedIterator = boost::iterators::transform_iterator<boost::range_detail::default_constructible_unary_fn_wrapper<main()::<lambda(const auto:1&)>, SourceEvent>, __gnu_cxx::__normal_iterator<int*, std::vector<int> >, boost::iterators::use_default, boost::iterators::use_default>; Reference = SourceEvent; Buffer = boost::any_iterator_buffer<64ul>; boost::range_detail::any_forward_iterator_wrapper<WrappedIterator, Reference, Buffer>::reference = SourceEvent&]': /usr/local/boost-1.60.0/include/boost/range/detail/any_iterator_wrapper.hpp:302:57: warning: function may return address of local variable [-Wreturn-local-addr] return dereference_cast<reference>(*m_it); ^ /usr/local/boost-1.60.0/include/boost/range/detail/any_iterator_wrapper.hpp:302:52: note: declared here return dereference_cast<reference>(*m_it); ^ prog.exe: prog.cc:7: void ASSERT_EQ(T1, T2) [with T1 = unsigned int; T2 = unsigned int]: Assertion `x == y' failed. Aborted The example is compiled with gcc 5.2 and boost 1.60 (http://melpon.org/wandbox/permlink/QF1qyw5bWHKwyKJ8). Is there an error in my code? I would guess that transforming a range into a range of new objects of another type is quite common, so it should work. I am also curious why the warning is only emitted when compiling with optimizations. Best wishes, Jens -- Jens Auer | CGI | Software-Engineer CGI (Germany) GmbH & Co. KG Rheinstra?e 95 | 64295 Darmstadt | Germany T: +49 6151 36860 154 jens.auer_at_[hidden]<mailto:jens.auer_at_[hidden]> Unsere Pflichtangaben gem?? ? 35a GmbHG / ?? 161, 125a HGB finden Sie unter de.cgi.com/pflichtangaben<http://de.cgi.com/pflichtangaben>. CONFIDENTIALITY NOTICE: Proprietary/Confidential information belonging to CGI Group Inc. and its affiliates may be contained in this message. If you are not a recipient indicated or intended in this message (or responsible for delivery of this message to such person), or you think for any reason that this message may have been addressed to you in error, you may not use or copy or deliver this message to anyone else. In such case, you should destroy this message and are asked to notify the sender by reply e-mail. _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk