Compile error with boost::tokenizer and Forte 6U2
Hi, I'm trying to use boost::tokenizer to tokenize colon-separated strings of the form "path1:path2:path3...". I wrote the following simple test program: #include <string> #include "boost/tokenizer.hpp" void func() { std::string s("abc:def:ghi"); boost::char_delimiters_separator<char> tokenizerFunc(false, "", ":"); boost::tokenizer<boost::char_delimiters_separator<char> > tokenizer(s, tokenizerFunc); } However, this fails to compile with the Sun Forte 6U2 compiler. It spews out the following error messages: "/nsm/rollsbuild/thirdparty/boost/boost_1_25_0/boost/detail/ob_compressed_pair.hpp", line 416: Warning (Anachronism): Type names qualified by template parameters require "typename". "/nsm/rollsbuild/thirdparty/boost/boost_1_25_0/boost/detail/ob_compressed_pair.hpp", line 416: Warning (Anachronism): Type names qualified by template parameters require "typename". "/nsm/rollsbuild/thirdparty/boost/boost_1_25_0/boost/detail/iterator.hpp", line 382: Warning (Anachronism): Type names qualified by template parameters require "typename". "/nsm/rollsbuild/thirdparty/boost/boost_1_25_0/boost/detail/iterator.hpp", line 382: Warning (Anachronism): Type names qualified by template parameters require "typename". "/nsm/rollsbuild/thirdparty/boost/boost_1_25_0/boost/iterator_adaptors.hpp", line 922: Error: Invalid template parameter default. "/nsm/rollsbuild/thirdparty/boost/boost_1_25_0/boost/iterator_adaptors.hpp", line 925: Error: Invalid template parameter default. "/nsm/rollsbuild/thirdparty/boost/boost_1_25_0/boost/iterator_adaptors.hpp", line 1116: Warning (Anachronism): Type names qualified by template parameters require "typename". "/nsm/rollsbuild/thirdparty/boost/boost_1_25_0/boost/iterator_adaptors.hpp", line 1133: Error: value is not a member of boost::is_convertible<boost::detail::reduce_to_base_class<std::forward_iterator_tag, boost::detail::iterator_traits<boost::detail::Iterator>::iterator_category>::type*, std::bidirectional_iterator_tag*>. "/nsm/rollsbuild/thirdparty/boost/boost_1_25_0/boost/token_iterator.hpp", line 90: Where: While specializing "boost::detail::non_bidirectional_category<const char*>". "/nsm/rollsbuild/thirdparty/boost/boost_1_25_0/boost/token_iterator.hpp", line 90: Where: Specialized in boost::token_iterator_generator<boost::char_delimiters_separator<char, std::char_traits<char>>, const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char>>>. "/nsm/rollsbuild/thirdparty/boost/boost_1_25_0/boost/tokenizer.hpp", line 37: Where: Specialized in boost::tokenizer<boost::char_delimiters_separator<char, std::char_traits<char>>, const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char>>>. "boostTest.cc", line 10: Where: Specialized in non-template code. "/nsm/rollsbuild/thirdparty/boost/boost_1_25_0/boost/iterator_adaptors.hpp", line 1133: Error: An integer constant expression is required here. "/nsm/rollsbuild/thirdparty/boost/boost_1_25_0/boost/token_iterator.hpp", line 90: Where: While specializing "boost::detail::non_bidirectional_category<const char*>". "/nsm/rollsbuild/thirdparty/boost/boost_1_25_0/boost/token_iterator.hpp", line 90: Where: Specialized in boost::token_iterator_generator<boost::char_delimiters_separator<char, std::char_traits<char>>, const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char>>>. "/nsm/rollsbuild/thirdparty/boost/boost_1_25_0/boost/tokenizer.hpp", line 37: Where: Specialized in boost::tokenizer<boost::char_delimiters_separator<char, std::char_traits<char>>, const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char>>>. "boostTest.cc", line 10: Where: Specialized in non-template code. "/nsm/rollsbuild/thirdparty/boost/boost_1_25_0/boost/iterator_adaptors.hpp", line 1134: Error: The type "boost::STATIC_ASSERTION_FAILURE<0>" is incomplete. "/nsm/rollsbuild/thirdparty/boost/boost_1_25_0/boost/token_iterator.hpp", line 90: Where: While specializing "boost::detail::non_bidirectional_category<const char*>". "/nsm/rollsbuild/thirdparty/boost/boost_1_25_0/boost/token_iterator.hpp", line 90: Where: Specialized in boost::token_iterator_generator<boost::char_delimiters_separator<char, std::char_traits<char>>, const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char>>>. "/nsm/rollsbuild/thirdparty/boost/boost_1_25_0/boost/tokenizer.hpp", line 37: Where: Specialized in boost::tokenizer<boost::char_delimiters_separator<char, std::char_traits<char>>, const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char>>>. "boostTest.cc", line 10: Where: Specialized in non-template code. 5 Error(s) and 7 Warning(s) detected. *** Error code 5 Am I using the class incorrectly, or is this a genuine problem? Jules d'Entremont -- Jules d'Entremont jules.dentremont@alcatel.com Alcatel Canada http://batai.ca.newbridge.com/~julesd 600 March Road 613-784-6633 Kanata ON, K2K 2E6
JULES D'ENTREMONT wrote:
"/nsm/rollsbuild/thirdparty/boost/boost_1_25_0/boost/iterator_adaptors.hpp", line 922: Error: Invalid template parameter default. "/nsm/rollsbuild/thirdparty/boost/boost_1_25_0/boost/iterator_adaptors.hpp", line 925: Error: Invalid template parameter default. "/nsm/rollsbuild/thirdparty/boost/boost_1_25_0/boost/iterator_adaptors.hpp",
Am I using the class incorrectly, or is this a genuine problem?
I haven't looked at your code, but Sun C++ 5.3 is definitely unable to handle iterator_adaptors.hpp (i.e. SunCC has bugs), which seems to be used by tokenizer. Try Sun C++ 5.4 Early Access, now available at Sun's www page. (No, I don't have an idea whether it fixes this particular problem, but someone claimed it would be much of an improvement over C++ 5.3.) Jens Maurer
--- In Boost-Users@y..., Jens Maurer <Jens.Maurer@g...> wrote:
JULES D'ENTREMONT wrote:
"/nsm/rollsbuild/thirdparty/boost/boost_1_25_0/boost/iterator_adapto rs.hpp",
line 922: Error: Invalid template parameter default.
"/nsm/rollsbuild/thirdparty/boost/boost_1_25_0/boost/iterator_adapto rs.hpp",
line 925: Error: Invalid template parameter default.
"/nsm/rollsbuild/thirdparty/boost/boost_1_25_0/boost/iterator_adapto rs.hpp",
Am I using the class incorrectly, or is this a genuine problem?
I haven't looked at your code, but Sun C++ 5.3 is definitely unable to handle iterator_adaptors.hpp (i.e. SunCC has bugs), which seems to be used by tokenizer.
It's not entirely true. I have working vertion of iterator_adaptors and tokenizer on SunPro C++ 5.3 compiler. Gennadiy. P.S. I will answer on original question tomorow separately
Try Sun C++ 5.4 Early Access, now available at Sun's www page. (No, I don't have an idea whether it fixes this particular problem, but someone claimed it would be much of an improvement over C++
5.3.)
Jens Maurer
--- In Boost-Users@y..., "JULES D'ENTREMONT" <jules.dentremont@a...> wrote:
Hi,
I'm trying to use boost::tokenizer to tokenize colon-separated strings of the form "path1:path2:path3...".
I wrote the following simple test program: #include <string> #include "boost/tokenizer.hpp"
void func() { std::string s("abc:def:ghi");
boost::char_delimiters_separator<char> tokenizerFunc (false, "", ":"); boost::tokenizer<boost::char_delimiters_separator<char> > tokenizer(s, tokenizerFunc); }
However, this fails to compile with the Sun Forte 6U2 compiler. It spews out the following error messages:
"/nsm/rollsbuild/thirdparty/boost/boost_1_25_0/boost/detail/ob_compr essed_pair.hpp", line 416: Warning (Anachronism): Type names qualified by template parameters require "typename".
Ignore those warnings
line 922: Error: Invalid template parameter default.
change const Value to Value const;
"/nsm/rollsbuild/thirdparty/boost/boost_1_25_0/boost/iterator_adapto rs.hpp", line 925: Error: Invalid template parameter default.
change const Value to Value const;
"/nsm/rollsbuild/thirdparty/boost/boost_1_25_0/boost/iterator_adapto rs.hpp",
"/nsm/rollsbuild/thirdparty/boost/boost_1_25_0/boost/iterator_adapto rs.hpp", line 1133: Error: value is not a member of
boost::is_convertible<boost::detail::reduce_to_base_class<std::forward _iterator_tag,
boost::detail::iterator_traits<boost::detail::Iterator>::iterator_cate gory>::type*,
std::bidirectional_iterator_tag*>. "/nsm/rollsbuild/thirdparty/boost/boost_1_25_0/boost/token_iterator. hpp",
I do not have such code. [SNIP] Also ifdef BOOST_STATIC_ASSERTs on is_input_or_output_iter and forward_iter_with_real_reference (~lines 616-630). Also check that partial specialization is turned on.
*** Error code 5
Am I using the class incorrectly, or is this a genuine problem?
Jules d'Entremont
-- Jules d'Entremont jules.dentremont@a... Alcatel Canada http://batai.ca.newbridge.com/~julesd 600 March Road 613-784-6633 Kanata ON, K2K 2E6
Let me know how it looks now. Gennadiy.
rogeeff wrote:
line 922: Error: Invalid template parameter default.
change const Value to Value const;
"/nsm/rollsbuild/thirdparty/boost/boost_1_25_0/boost/iterator_adapto
rs.hpp",
line 925: Error: Invalid template parameter default.
change const Value to Value const;
These changes eliminate those two particular errors, however I'm still left with the following: "/users/julesd/boost/boost_1_25_0/boost/iterator_adaptors.hpp", line 1137: Error: value is not a member of boost::is_convertible<boost::detail::reduce_to_base_class<std::forward_iterator_tag, boost::detail::iterator_traits<boost::detail::Iterator>::iterator_category>::type*, std::bidirectional_iterator_tag*>. "/users/julesd/boost/boost_1_25_0/boost/iterator_adaptors.hpp", line 1137: Error: An integer constant expression is required here. "/users/julesd/boost/boost_1_25_0/boost/iterator_adaptors.hpp", line 1138: Error: The type "boost::STATIC_ASSERTION_FAILURE<0>" is incomplete. Thanks for your help. At this point there is little more I can do. This is for production software, and I don't have control over which compiler we use. And given how much trouble it was for me to convince the powers that be to let me use boost at all, I don't want to try to convince them to let me modify the sources or to install a different version. I guess I'll have to write my own tokenizer class. Jules. -- Jules d'Entremont jules.dentremont@alcatel.com Alcatel Canada http://batai.ca.newbridge.com/~julesd 600 March Road 613-784-6633 Kanata ON, K2K 2E6
participants (3)
-
Jens Maurer
-
JULES D'ENTREMONT
-
rogeeff