id summary reporter owner description type status milestone component version severity resolution keywords cc 3338 proto: const-correctness issue on transforms (array types) François Barel Eric Niebler "This has been extracted from Spirit2 test failures on gcc in C++0x mode (e.g. http://tinyurl.com/mmo2ym). When adding this line to Proto's matches.cpp test: {{{ Index: matches.cpp =================================================================== --- matches.cpp (revision 55531) +++ matches.cpp (working copy) @@ -172,6 +172,8 @@ assert_matches< terminal >( as_child(""hello"") ); assert_matches< terminal >( as_expr(""hello"") ); + assert_not_matches< if_()> >( lit(""hello"") ); + assert_matches< terminal >( lit(std::string(""hello"")) ); assert_matches< terminal >( as_child(std::string(""hello"")) ); assert_matches< terminal >( as_expr(std::string(""hello"")) ); }}} the test no longer compiles on gcc-4.3 or later in C++0x mode, although it works fine in non-C++0x mode. The error is not the {{{is_same}}} check failing, but happens during instantiation of {{{proto::_value}}}: {{{ In file included from matches.cpp:16:0: boost/proto/transform/arg.hpp: In instantiation of '_value::impl, 0l>, int, int>': ... boost/proto/transform/arg.hpp:203:13: error: function returning an array }}} [[br]] AFAICT the issue is always there, but becomes visible due to {{{BOOST_HAS_DECLTYPE}}} (which gets defined in C++0x mode, and modifies the result types of several transforms in {{{transform/arg.hpp}}}). Considering {{{_value::impl}}} here: - It is called with a terminal containing a {{{char const (&)[6]}}}, - {{{result_type}}} is always {{{result_of::value::type}}} -- here {{{char*}}}, which seems incorrect (missing {{{const}}}), - When {{{BOOST_HAS_DECLTYPE}}} is defined, the return type of {{{operator()}}} is {{{result_type}}} so this generates a compilation error, - When it is not defined, the return type of {{{operator()}}} becomes {{{result_of::value::type}}} -- here {{{char const (&)[6]}}}, so the test compiles. " Bugs closed Boost 1.41.0 proto Boost Development Trunk Problem invalid transform _value _child_c const function returning array