Modify

Ticket #7025 (closed Bugs: fixed)

Opened 22 months ago

Last modified 8 months ago

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) (diff)

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.

Attachments

Change History

comment:1 Changed 11 months ago by viboes

  • Description modified (diff)

comment:2 Changed 11 months ago by viboes

  • Owner changed from jano_gaspar to viboes
  • Status changed from new to assigned

comment:3 Changed 11 months ago by viboes

  • Component changed from circular_buffer to call_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 Changed 11 months ago by viboes

  • Owner changed from viboes to johnmaddock
  • Status changed from assigned to new

comment:5 Changed 11 months ago by johnmaddock

  • Owner changed from johnmaddock 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 Changed 10 months ago by viboes

  • Component changed from call_traits to circular_buffer

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

comment:7 Changed 10 months ago by viboes

  • Milestone changed from To Be Determined to Boost 1.55.0

Committed revision [84971].

comment:8 Changed 8 months ago by viboes

  • Status changed from new to closed
  • Resolution set to fixed
View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.