Opened 11 years ago
Closed 11 years ago
#5632 closed Bugs (invalid)
regex::str() method broken
Reported by: | Owned by: | John Maddock | |
---|---|---|---|
Milestone: | To Be Determined | Component: | regex |
Version: | Boost 1.46.0 | Severity: | Problem |
Keywords: | regex basic_regex str | Cc: |
Description
The str() method is not returning a string representation of the regular expression after instantiation of a regex.
Example program:
#include <iostream> #include <boost/regex.hpp> int main(int argc, char *argv[]) { boost::regex foo("foo"); std::cout << foo.str() << std::endl; }
merely prints an empty line rather than "foo".
Change History (6)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
Boost version is 1.46.0 (see original bug report). Platform/compiler is a Fedora 15 Linux system with g++ 4.6.0.
The program works as expected on a RHEL 5 Linux system with g++ 4.1.2 and boost 1.33.1.
It also works fine on a Mac OS X 10.8.0 machine with boost 1.41.
comment:3 by , 11 years ago
Oops, forgot to note that the compiler for the Mac OS test was g++ 4.2.1.
comment:4 by , 11 years ago
Hmmm, still can't reproduce with gcc-4.6.0 on Ubuntu. In order to save me from having to install yet another virtual machine, can you step through the str() method and see what's going on?
Thanks! John.
comment:5 by , 11 years ago
Stepping through the str() call pointed out my problem, when I saw that the headers being used were coming from a Boost installation under /usr/local (a Boost 1.44 copy which I did not realize was there). I thought I only had Boost 1.46 from a standard package installation under /usr.
With no special compiler flags, the 1.44 headers were being loaded from /usr/local/include, but the program was linking with the 1.46 library in /usr/lib. That seems to trigger the problem, likely related to different inlined implementations of boost::basic_regex::str().
Regardless, things work correctly if I build strictly with either the 1.44 copy of Boost or the 1.46 copy. I.e., it's my own dang fault.
Sorry for the trouble!
comment:6 by , 11 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Works for me with both VC10 and g++/Linux.
What platform/compiler are you using, Boost version also please.
Thanks, John.