Opened 10 years ago

Closed 9 years ago

#7025 closed Bugs (fixed)

circular buffer reports warning: " type qualifiers ignored on function return type" while compile.

Reported by: alps_xing@… Owned by: viboes
Milestone: Boost 1.55.0 Component: circular_buffer
Version: Boost 1.49.0 Severity: Problem
Keywords: Cc:

Description (last modified by viboes)

If using circular in my application, GCC will report warning as:

../../../packages/target/libboost_1_49_0/include/boost/circular_buffer/base.hpp:386: warning: type qualifiers ignored on function return type
../../../packages/target/libboost_1_49_0/include/boost/circular_buffer/base.hpp:424: warning: type qualifiers ignored on function return type
../../../packages/target/libboost_1_49_0/include/boost/circular_buffer/base.hpp:478: warning: type qualifiers ignored on function return type
../../../packages/target/libboost_1_49_0/include/boost/circular_buffer/base.hpp:496: warning: type qualifiers ignored on function return type

I think it's caused by the "const" decorator.

Change History (8)

comment:1 by viboes, 9 years ago

Description: modified (diff)

comment:2 by viboes, 9 years ago

Owner: changed from Jan Gaspar to viboes
Status: newassigned

comment:3 by viboes, 9 years ago

Component: circular_buffercall_traits

I suspect that this need a change in boost/detail/call_traits.hpp

The following

template <typename T>
struct ct_imp2<T, true>
{
   typedef const T param_type;
};

should be

template <typename T>
struct ct_imp2<T, true>
{
   typedef T param_type;
};

comment:4 by viboes, 9 years ago

Owner: changed from viboes to John Maddock
Status: assignednew

comment:5 by John Maddock, 9 years ago

Owner: changed from John Maddock to viboes

I'm unable to reproduce here - anyone have a test case?

In any case, circular_buffer is abusing call_traits::param_type which is designed for parameters and not return values. And yes it really should be const ;-)

Use call_traits::value_type or call_traits::const_reference for those return types (I think I would settle for the latter).

comment:6 by viboes, 9 years ago

Component: call_traitscircular_buffer

You are right. As the documentation states, the return type should be const_reference.

comment:7 by viboes, 9 years ago

Milestone: To Be DeterminedBoost 1.55.0

Committed revision [84971].

comment:8 by viboes, 9 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.