Modify

Opened 5 years ago

Closed 4 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.

Attachments (0)

Change History (8)

comment:1 Changed 4 years ago by viboes

  • Description modified (diff)

comment:2 Changed 4 years ago by viboes

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

comment:3 Changed 4 years 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 4 years ago by viboes

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

comment:5 Changed 4 years 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 4 years 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 4 years ago by viboes

  • Milestone changed from To Be Determined to Boost 1.55.0

Committed revision [84971].

comment:8 Changed 4 years ago by viboes

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

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain viboes.
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.