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: boris.glick@… 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)

Bug_in_istarts_with.cpp (666 bytes ) - added by boris.glick@… 14 years ago.
Code sample to demonstrate a bug. Compile with /Zc:wchar_t-

Download all attachments as: .zip

Change History (4)

by boris.glick@…, 14 years ago

Attachment: Bug_in_istarts_with.cpp added

Code sample to demonstrate a bug. Compile with /Zc:wchar_t-

comment:1 by Pavol Droba, 14 years ago

Cc: droba@… added
Component: string_algorange
Owner: changed from Pavol Droba to Thorsten Ottosen

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:2 by Thorsten Ottosen, 14 years ago

Fix in trunk ...

comment:3 by Thorsten Ottosen, 14 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.