Opened 11 years ago
Closed 10 years ago
#6680 closed Bugs (fixed)
Compilation error at regex file basic_regex_parser.hpp
Reported by: | Owned by: | John Maddock | |
---|---|---|---|
Milestone: | To Be Determined | Component: | regex |
Version: | Boost 1.49.0 | Severity: | Problem |
Keywords: | Cc: |
Description
Hi,
Compile boost 1.49.0 on Sun SPARC 5.10 using Sun Studio 12 yield compilation error on file "basic_regex_parser.hpp".
Line 208 of that file contains the following:
message += std::string(m_base + start_pos, m_base + position); message += ">>>HERE>>>"; message += std::string(m_base + position, m_base + end_pos);
where m_base, poition, start_pos and end_pos defined as: const charT* m_base; std::ptrdiff_t position, std::string message, std::ptrdiff_t start_pos
The problem occurs when compile the regex source file "wide_posix_api.cpp" which indirectly include the file "basic_regex_parser.hpp".
It look like the above code attempts to constructs a nice std::string error message providing it a small piece of the regex, which in this case is of wide string type (i.e., construct stdd:string using wchar_t*).
The existent nearest constructor: basic_string (const _charT*, const _charT*, const _Allocator& _RWSTD_DEFAULT_ARG(_Allocator()));
where "_charT" is either "char" or "wchar_t", right?!
You can have: 1) basic_string<char>(char* b, char* e) 2) basic_string<wchar_t>(wchar_t* b, wchar_t* e)
But definitively not: basic_string<char>(wchar_t* b, wchar_t* e) This is a MISHMASH.
(what error message will be look like if it start as a std::string, than you concat it piece of wide string, and and end is with a std::string? it will be garbaged).
Here is the compilation error:
miko@compile1-U10-zone<5>libs/regex/src > miko@compile1-U10-zone<5>libs/regex/src > pwd /VOBS/n2_3rd_party_components/boost/dev/boost_1_49_0/libs/regex/src miko@compile1-U10-zone<5>libs/regex/src > miko@compile1-U10-zone<5>libs/regex/src > miko@compile1-U10-zone<5>libs/regex/src > CC -V CC: Sun C++ 5.12 SunOS_sparc 2011/11/16 miko@compile1-U10-zone<5>libs/regex/src > miko@compile1-U10-zone<5>libs/regex/src > miko@compile1-U10-zone<5>libs/regex/src > CC -c -g -I../../.. wide_posix_api.cpp "../../../boost/regex/v4/basic_regex_parser.hpp", line 208: Error: Could not find a match for std::string::basic_string(const wchar_t*, const wchar_t*) needed in boost::re_detail::basic_regex_parser<wchar_t, boost::c_regex_traits<wchar_t>>::fail(boost::regex_constants::error_type, int, std::string, int). "../../../boost/regex/v4/basic_regex_parser.hpp", line 51: Where: While instantiating "boost::re_detail::basic_regex_parser<wchar_t, boost::c_regex_traits<wchar_t>>::fail(boost::regex_constants::error_type, int, std::string, int)". "../../../boost/regex/v4/basic_regex_parser.hpp", line 51: Where: Instantiated from boost::re_detail::basic_regex_parser<wchar_t, boost::c_regex_traits<wchar_t>>::parse(const wchar_t*, const wchar_t*, unsigned). "../../../boost/regex/v4/basic_regex.hpp", line 212: Where: Instantiated from boost::basic_regex<wchar_t, boost::c_regex_traits<wchar_t>>::do_assign(const wchar_t*, const wchar_t*, unsigned). "../../../boost/regex/v4/basic_regex.hpp", line 379: Where: Instantiated from non-template code. "../../../boost/regex/v4/basic_regex_parser.hpp", line 210: Error: Could not find a match for std::string::basic_string(const wchar_t*, const wchar_t*) needed in boost::re_detail::basic_regex_parser<wchar_t, boost::c_regex_traits<wchar_t>>::fail(boost::regex_constants::error_type, int, std::string, int). "../../../boost/regex/v4/basic_regex_parser.hpp", line 51: Where: While instantiating "boost::re_detail::basic_regex_parser<wchar_t, boost::c_regex_traits<wchar_t>>::fail(boost::regex_constants::error_type, int, std::string, int)". "../../../boost/regex/v4/basic_regex_parser.hpp", line 51: Where: Instantiated from boost::re_detail::basic_regex_parser<wchar_t, boost::c_regex_traits<wchar_t>>::parse(const wchar_t*, const wchar_t*, unsigned). "../../../boost/regex/v4/basic_regex.hpp", line 212: Where: Instantiated from boost::basic_regex<wchar_t, boost::c_regex_traits<wchar_t>>::do_assign(const wchar_t*, const wchar_t*, unsigned). "../../../boost/regex/v4/basic_regex.hpp", line 379: Where: Instantiated from non-template code. 2 Error(s) detected. Exit 2 miko@compile1-U10-zone<5>libs/regex/src > miko@compile1-U10-zone<5>libs/regex/src >
(In [79342]) Add workaround for old broken compilers that don't support template construct/assign to containers. Fixes #6680.