This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/39145] New: g++ -O3 -std=c++0x causes compile error in boost regex
- From: "john32979 at hotmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 Feb 2009 04:45:02 -0000
- Subject: [Bug c++/39145] New: g++ -O3 -std=c++0x causes compile error in boost regex
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Compiling the snippet below using
g++ -O3 -std=c++0x foo.cpp -lboost_regex
fails.
However, the compile succeeds with:
g++ -O2 -std=c++0x foo.cpp -lboost_regex
g++ -O2 -std=c++0x foo.cpp -funswitch-loops -fpredictive-commoning
-fgcse-after-reload -ftree-vectorize foo.cpp -lboost_regex (i.e. -O3 without
-finline-functions)
g++ -O3 foo.cpp -lboost_regex
foo.cpp is below:
#include <iostream>
#include <stdint.h>
#include <boost/regex.hpp>
#include <cstdio>
#include <cstring>
int main(int argc, char**argv) {
const char *first = "abcd";
const char *last = first + strlen(first);
boost::cmatch mr;
boost::regex rx("abc");
boost::regex_constants::match_flag_type fl =
boost::regex_constants::match_default;
std::cout << "search(f, f+1, \"abc\") == " << std::boolalpha
<< regex_search(first, first + 1, rx, fl) << std::endl;
std::cout << "search(f, l, \"abc\") == " << std::boolalpha
<< regex_search(first, last, mr, rx) << std::endl;
std::cout << " matched: \"" << mr.str() << "\"" << std::endl;
std::cout << "search(\"a\", \"abc\") == " << std::boolalpha
<< regex_search("a", rx) << std::endl;
std::cout << "search(\"xabcd\", \"abc\") == " << std::boolalpha
<< regex_search("xabcd", mr, rx) << std::endl;
std::cout << " matched: \"" << mr.str() << "\"" << std::endl;
std::cout << "search(string, \"abc\") == " << std::boolalpha
<< regex_search(std::string("a"), rx) << std::endl;
std::string str("abcabc");
boost::match_results<std::string::const_iterator> mr2;
std::cout << "search(string, \"abc\") == " << std::boolalpha
<< boost::regex_search(str, mr2, rx) << std::endl;
std::cout << " matched: \"" << mr2.str() << "\"" << std::endl;
return 0;
}
The compile error generated is:
/usr/include/c++/4.3/bits/stl_pair.h: In constructor â??std::pair<_T1,
_T2>::pair(_U1&&, _U2&&) [with _U1 = boost::shared_ptr<const
boost::re_detail::cpp_regex_traits_implementation<char> >&, _U2 = int, _T1 =
boost::shared_ptr<const boost::re_detail::cpp_regex_traits_implementation<char>
>, _T2 = const boost::re_detail::cpp_regex_traits_base<char>*]â??:
/usr/include/boost/regex/pending/object_cache.hpp:122: instantiated from
â??static boost::shared_ptr<const Object> boost::object_cache<Key,
Object>::do_get(const Key&, typename
std::list<std::pair<boost::shared_ptr<const Object>, const Key*>,
std::allocator<std::pair<boost::shared_ptr<const Object>, const Key*> >
>::size_type) [with Key = boost::re_detail::cpp_regex_traits_base<char>, Object
= boost::re_detail::cpp_regex_traits_implementation<char>]â??
/usr/include/boost/regex/pending/object_cache.hpp:69: instantiated from
â??static boost::shared_ptr<const Object> boost::object_cache<Key,
Object>::get(const Key&, typename std::list<std::pair<boost::shared_ptr<const
Object>, const Key*>, std::allocator<std::pair<boost::shared_ptr<const Object>,
const Key*> > >::size_type) [with Key =
boost::re_detail::cpp_regex_traits_base<char>, Object =
boost::re_detail::cpp_regex_traits_implementation<char>]â??
/usr/include/boost/regex/v4/cpp_regex_traits.hpp:828: instantiated from
â??boost::shared_ptr<const
boost::re_detail::cpp_regex_traits_implementation<charT> >
boost::re_detail::create_cpp_regex_traits(const std::locale&) [with charT =
char]â??
/usr/include/boost/regex/v4/cpp_regex_traits.hpp:848: instantiated from
â??boost::cpp_regex_traits<charT>::cpp_regex_traits() [with charT = char]â??
/usr/include/boost/regex/v4/regex_traits.hpp:75: instantiated from
â??boost::regex_traits<charT, implementationT>::regex_traits() [with charT =
char, implementationT = boost::cpp_regex_traits<char>]â??
/usr/include/boost/regex/v4/regex_traits.hpp:169: instantiated from
â??boost::regex_traits_wrapper<BaseT>::regex_traits_wrapper() [with BaseT =
boost::regex_traits<char, boost::cpp_regex_traits<char> >]â??
/usr/include/boost/regex/v4/basic_regex.hpp:61: instantiated from
â??boost::re_detail::regex_data<charT, traits>::regex_data() [with charT =
char, traits = boost::regex_traits<char, boost::cpp_regex_traits<char> >]â??
/usr/include/boost/regex/v4/basic_regex.hpp:93: instantiated from
â??boost::re_detail::basic_regex_implementation<charT,
traits>::basic_regex_implementation() [with charT = char, traits =
boost::regex_traits<char, boost::cpp_regex_traits<char> >]â??
/usr/include/boost/regex/v4/basic_regex.hpp:525: instantiated from
â??boost::basic_regex<charT, traits>& boost::basic_regex<charT,
traits>::do_assign(const charT*, const charT*,
boost::regex_constants::syntax_option_type) [with charT = char, traits =
boost::regex_traits<char, boost::cpp_regex_traits<char> >]â??
/usr/include/boost/regex/v4/basic_regex.hpp:262: instantiated from
â??boost::basic_regex<charT, traits>& boost::basic_regex<charT,
traits>::assign(const charT*, const charT*,
boost::regex_constants::syntax_option_type) [with charT = char, traits =
boost::regex_traits<char, boost::cpp_regex_traits<char> >]â??
/usr/include/boost/regex/v4/basic_regex.hpp:247: instantiated from
â??boost::basic_regex<charT, traits>& boost::basic_regex<charT,
traits>::assign(const charT*, boost::regex_constants::syntax_option_type) [with
charT = char, traits = boost::regex_traits<char, boost::cpp_regex_traits<char>
>]â??
/usr/include/boost/regex/v4/basic_regex.hpp:216: instantiated from
â??boost::basic_regex<charT, traits>::basic_regex(const charT*,
boost::regex_constants::syntax_option_type) [with charT = char, traits =
boost::regex_traits<char, boost::cpp_regex_traits<char> >]â??
foo.cpp:11: instantiated from here
/usr/include/c++/4.3/bits/stl_pair.h:95: error: invalid conversion from
â??intâ?? to â??const boost::re_detail::cpp_regex_traits_base<char>*â??
gcc -v is:
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.3.2-1ubuntu12'
--with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3
--program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug
--enable-objc-gc --enable-mpfr --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.3.2 (Ubuntu 4.3.2-1ubuntu12)
--
Summary: g++ -O3 -std=c++0x causes compile error in boost regex
Product: gcc
Version: 4.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: john32979 at hotmail dot com
GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39145