Subject: [Boost-bugs] [Boost C++ Libraries] #3338: proto: const-correctness issue on transforms (array types)
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-08-11 18:41:45
#3338: proto: const-correctness issue on transforms (array types)
-------------------------------------------------------------+--------------
Reporter: François Barel <frabar666@â¦> | Owner: eric_niebler
Type: Bugs | Status: new
Milestone: Boost 1.40.0 | Component: proto
Version: Boost Development Trunk | Severity: Problem
Keywords: transform _value const function returning array |
-------------------------------------------------------------+--------------
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<char [N]> >( as_child("hello") );
assert_matches< terminal<char [N]> >( as_expr("hello") );
+ assert_not_matches< if_<is_same<_value, int>()> >( lit("hello") );
+
assert_matches< terminal<std::string> >( lit(std::string("hello")) );
assert_matches< terminal<std::string> >(
as_child(std::string("hello")) );
assert_matches< terminal<std::string> >(
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<exprns_::expr<tag::terminal,
argsns_::term<const char (&)[6]>, 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<Expr>::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<typename impl::expr_param>::type}}} -- here {{{char
const (&)[6]}}}, so the test compiles.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/3338> 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:01 UTC