Opened 7 years ago

Closed 7 years ago

#6540 closed Bugs (fixed)

Erroneous default argument in basic_string::compare overload

Reported by: Erik Jensen <Erik.Jensen@…> Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: container
Version: Boost 1.49.0 Severity: Problem
Keywords: Cc:


basic_string in string.hpp contains the following definition:

int compare(size_type pos1, size_type n1, const CharT* s, size_type n2 = npos) const {...}

However, n2 should not have a default argument. It interferes with calling "int compare(size_type pos1, size_type n1, const CharT* s) const", and a value of npos makes no sense for n2 anyway (it would mean the passed c string had "infinite" length).

Thank you, Erik Jensen

Change History (1)

comment:1 Changed 7 years ago by Ion Gaztañaga

Resolution: fixed
Status: newclosed

Thanks for the report, fixed in both release and trunk branches at revisions 76985 & 76986.

Note: See TracTickets for help on using tickets.