Opened 14 years ago
Closed 14 years ago
#2903 closed Bugs (fixed)
istarts_with fails when called for a literal widechar string (VS2005 with /Zc:wchar_t-)
Reported by: | Owned by: | Thorsten Ottosen | |
---|---|---|---|
Milestone: | Component: | range | |
Version: | Boost 1.37.0 | Severity: | Problem |
Keywords: | istarts_with, is_char_ptr, /Zc:wchar_t- | Cc: | droba@… |
Description
When compiled with the flag /Zc:wchar_t-, this call returns false:
istarts_with(L"Prefix.FollowedByText", L"Prefix")
The reason, as far as I could determine:
When /Zc:wchar_t- is defined, range_detail::is_char_ptr(L"Prefix") returns false, and as_literal() treats its argument as an array. So boost::end() points past the terminating NULL character, and the comparison fails.
Attachments (1)
Change History (4)
by , 14 years ago
Attachment: | Bug_in_istarts_with.cpp added |
---|
comment:1 by , 14 years ago
Cc: | added |
---|---|
Component: | string_algo → range |
Owner: | changed from | to
This is not something, that can reasonably be fixed inside string_algo library. literal processing is part of range library, therefore i'm reassigning it there.
comment:3 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Code sample to demonstrate a bug. Compile with /Zc:wchar_t-