Opened 9 years ago

#9329 new Bugs

Compilation fixes for Sun CC and its ancient standard library

Reported by: vz-boost@… Owned by: Vladimir Prus
Milestone: To Be Determined Component: program_options
Version: Boost 1.54.0 Severity: Problem
Keywords: Cc:

Description

This patch avoids the following errors when compiling the library using Sun CC (Sun C++ 5.10 SunOS_i386 2009/06/03):

"libs/program_options/src/options_description.cpp", line 422: Error, nomatchoverin: Could not find a match for std::count<std::_InputIterator, std::_T, std::_Size>(char*, char*, char) needed in::format_paragraph(std::ostream &, std::string, unsigned, unsigned).
"libs/program_options/src/options_description.cpp", line 
"libs/program_options/src/options_description.cpp", line 483: Error, toofewtargs: Too few arguments for template std::reverse_iterator.
"/opt/sunstudio12.1/prod/include/CC/Cstd/rw/iterator", line 426: Error, nofunctmpl: "friend" declaration is incompatible with function template.
"libs/program_options/src/options_description.cpp", line 483:     Where, temwhilespec: While specializing "std::reverse_iterator<const char*>".
"libs/program_options/src/options_description.cpp", line 483:     Where, temspecend: Specialized in non-template code.
"libs/program_options/src/options_description.cpp", line 484: Error, toofewtargs: Too few arguments for template std::reverse_iterator.
472: Error, nomatchoverin: Could not find a match for std::distance<std::_ForwardIterator, std::_Distance>(const char*, const char*const) needed in::format_paragraph(std::ostream &, std::string, unsigned, unsigned).
"libs/program_options/src/value_semantic.cpp", line 371: Error, nomatchoverin: Could not find a match for std::vector<std::string>::vector(__rwstd::__rb_tree<std::string, std::string, __rwstd::__ident<std::string, std::string>, std::less<std::string>, std::allocator<std::string>>::const_iterator, __rwstd::__rb_tree<std::string, std::string, __rwstd::__ident<std::string, std::string>, std::less<std::string>, std::allocator<std::string>>::const_iterator) needed in boost::program_options::ambiguous_option::substitute_placeholders(const std::string &) const.

I don't really understand neither of them, unfortunately: looking at the standard library headers both the calls to count() and distance() should compile. OTOH neither of them is really necessary so I hope this patch can be applied nevertheless. With reverse_iterator it's more mysterious but, again, IMHO its use in the original code is not really needed, so I've just replaced it with rfind().

The last error is clear: this compiler standard library doesn't provide template ctor of std::vector from an iterator pair, so an alternative method of constructing it must be used. This does make the code less concise and elegant, but unfortunately I don't see any other way to make it work in this case.

TIA!

Attachments (1)

suncc_po.diff (3.7 KB ) - added by vz-boost@… 9 years ago.
Proposed patch to fix the build with Sun CC

Download all attachments as: .zip

Change History (1)

by vz-boost@…, 9 years ago

Attachment: suncc_po.diff added

Proposed patch to fix the build with Sun CC

Note: See TracTickets for help on using tickets.