Subject: Re: [Boost-bugs] [Boost C++ Libraries] #3603: Fix warnings when compiling test cases
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-11-19 07:28:12
#3603: Fix warnings when compiling test cases
-------------------------------------------+--------------------------------
Reporter: s.ochsenknecht@⦠| Owner: vladimir_prus
Type: Bugs | Status: new
Milestone: Boost 1.41.0 | Component: program_options
Version: Boost 1.40.0 | Severity: Cosmetic
Keywords: |
-------------------------------------------+--------------------------------
Comment(by s_ochsenknecht):
I guess I found the problem, my first approach was due to
misunderstanding. Sorry for confusion.
Here is what the gcc manual says about this warning:
{{{
Warn if the return type of a function has a type qualifier such as const.
For ISO C such a type qualifier has no effect, since the value returned by
a function is not an lvalue.
}}}
So, the any cast is supposed to return "const T* const" due to the
template parameter <const T>. Here is declaration of the any_cast:
{{{
template<typename ValueType> const ValueType * any_cast(const any *
operand);
}}}
So, the line in detail/value_semantic.hpp has to be changed from:
{{{
const T* value = boost::any_cast<const T>(&value_store);
}}}
to
{{{
const T* value = boost::any_cast<T>(&value_store);
}}}
I attached a new any_cast_warning.2.patch and a test case any_warning.cpp
Cheers,
Sascha
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/3603#comment:8> 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