Opened 10 years ago

Closed 10 years ago

#7365 closed Bugs (fixed)

warning: type qualifiers ignored on function return type

Reported by: anonymous Owned by: Gennadiy Rozental
Milestone: To Be Determined Component: test
Version: Boost 1.50.0 Severity: Problem
Keywords: Cc:

Description

Dears,

I have some flood of warnings like:

../../../../externals/boost/test/utils/basic_cstring/basic_cstring.hpp: In instantiation of 'boost::unit_test::basic_cstring<const char>': ../../../../externals/boost/test/predicate_result.hpp:73: instantiated from here ../../../../externals/boost/test/utils/basic_cstring/basic_cstring.hpp:209: warning: type qualifiers ignored on function return type ../../../../externals/boost/test/utils/basic_cstring/basic_cstring.hpp:218: warning: type qualifiers ignored on function return type

My explanation is that, the problem is in basic_cstring function, that works with "const T" and "T" as template, but return type ignores "const" qualifier when returns copy of the object.

The compiler ignores in return type when using const T instead of T.

It seems to be because:

basic_cstring<CharT>::value_type

for

"basic_cstring<const char>::value_type == const char" but "const char == char" when returned as value.

I do not see simple patch without using e.g. Boost::MPL and remove const when return value is done as copy by value.

Regards,

Change History (2)

comment:1 by habdank@…, 10 years ago

I forgot mail.

comment:2 by Gennadiy Rozental, 10 years ago

Resolution: fixed
Status: newclosed

(In [81184]) Fixes #7365

Note: See TracTickets for help on using tickets.