#831 closed Bugs (Wont Fix)
regex v1.33.1 match_results::format compile error in vc6
Reported by: | jeffreyren | Owned by: | John Maddock |
---|---|---|---|
Milestone: | Component: | regex | |
Version: | None | Severity: | |
Keywords: | Cc: |
Description
Hello, I try boost v1.33.1 regex match_results::format in msvc6 sp6, but receive the following error: c:\program files\microsoft visual studio\vc98\include\xlocnum(267) : fatal error C1001: INTERNAL COMPILER ERROR (compiler file 'msc1.cpp', line 1794) Please choose the Technical Support command on the Visual C++ Help menu, or open the Technical Support help file for more information Reproduce: VC6-->Create a MDI application --> add the following code: string strfind = "b(.)"; string Str = "abc"; string fmt = "x\\1y"; regex reg(strfind); smatch match; bool bFind = regex_search(Str, match, reg, match_default); if(bFind) { string Rep = match.format(fmt, format_default); } I want to know if there is any method to support match_results::format compile? Thanks. Jeffrey
Change History (4)
comment:2 by , 16 years ago
Logged In: YES user_id=1396355 Originator: YES Thanks for your reply. In fact I have tested regex_replace and it's OK. The only question regex_replace will replace first or all the occurrences in the string, what I want is to replace the last occurrence. BTW, is VC6+STLPort can support regex compile in vc6?
comment:3 by , 16 years ago
Logged In: YES user_id=14804 Originator: NO Yes, regex_replace will replace the first occurance or all of them, not the last only. And yes it works with VC6+STLport as well. Looking at your error, the following code compiles OK for me with VC6, do you have the latest compiler service packs (it's up 5 or 6 now I think) installed? Otherwise it might be a case of fiddling around with your compiler settings / and or code until you find a combination that doesn't choke the compiler. John. Here's the code that works for me: #include <boost/regex.hpp> int main() { using namespace std; using namespace boost; string strfind = "b(.)"; string Str = "abc"; string fmt = "x\\1y"; regex reg(strfind); smatch match; bool bFind = regex_search(Str, match, reg, match_default); if(bFind) { string Rep = match.format(fmt, format_default); } return 0; }
comment:4 by , 16 years ago
Logged In: YES user_id=1396355 Originator: YES Thanks John, I have found out why. I'm using VC6 SP6. Yes, you code works fine for general C++ project VC6 SP6. But the compiler error occurs only in VC6 mfc-relevant project. So the better choice seems to be vc6+stlport. Thanks again for your time! Jeffrey
Note:
See TracTickets
for help on using tickets.