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 5 years ago by viboes

Description: modified (diff)

comment:2 Changed 5 years ago by viboes

Owner: changed from Jan Gaspar to viboes
Status: newassigned

comment:3 Changed 4 years ago by viboes

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

Owner: changed from viboes to John Maddock
Status: assignednew

comment:5 Changed 4 years ago by John Maddock

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

Component: call_traitscircular_buffer

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

comment:7 Changed 4 years ago by viboes

Milestone: To Be DeterminedBoost 1.55.0

Committed revision [84971].

comment:8 Changed 4 years ago by viboes

Resolution: fixed
Status: newclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain viboes.
The resolution will be deleted.

Add Comment


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

 
Note: See TracTickets for help on using tickets.