Ticket #6540 (closed Bugs: fixed)

Opened 5 years ago

Last modified 5 years ago

Erroneous default argument in basic_string::compare overload

Reported by: Erik Jensen <Erik.Jensen@…> Owned by: igaztanaga
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

comment:1 Changed 5 years ago by igaztanaga

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

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


Add a comment

Modify Ticket

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

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

Note: See TracTickets for help on using tickets.