#9189 closed Bugs (wontfix)
Solaris Studio 12.3, boost::log: explicit template instantiations need "template<>"
Reported by: | Owned by: | Andrey Semashev | |
---|---|---|---|
Milestone: | To Be Determined | Component: | log |
Version: | Boost 1.54.0 | Severity: | Problem |
Keywords: | Cc: | Brian, Vandenberg, <phantall+boost@…> |
Description
When building libs/log/src/settings_parser.cpp with Solaris Studio 12.3, I'm getting the following errors. FYI: I changed convert.hpp by applying the fix suggested in ticket #7513.
"./boost/fusion/sequence/convert.hpp", line 23: Error: apply is not a member of boost::fusion::extension::convert_impl<boost::fusion::struct_tag>. "./boost/fusion/mpl/push_front.hpp", line 28: Where: While specializing "boost::fusion::result_of::convert</*...*/>" /* A bunch more "While specialing" and "Specialized in" and "Instantiated from" statements */ "libs/log/src/settings_parser.cpp", line 209: Where: Instantiated from boost::log::v2s_mt_posix::parse_settings<char>(std::istream &). "libs/log/src/settings_parser.cpp", line 237: Where: Instantiated from non-template code. "./boost/fusion/sequence/convert.hpp", line 25: Error: boost::fusion::result_of::convert</*...*/>::gen is not a namespace or class name. /* ... */ "libs/log/src/settings_parser.cpp", line 209: Where: Instantiated from boost::log::v2s_mt_posix::parse_settings<char>(std::istream &). "libs/log/src/settings_parser.cpp", line 237: Where: Instantiated from non-template code. "./boost/fusion/sequence/convert.hpp", line 25: Error: No parameters provided for template. /* ... */ "libs/log/src/settings_parser.cpp", line 209: Where: Instantiated from boost::log::v2s_mt_posix::parse_settings<char>(std::istream &). "libs/log/src/settings_parser.cpp", line 237: Where: Instantiated from non-template code. "./boost/fusion/sequence/convert.hpp", line 25: Error: Redefining boost::type<boost::T> after use in boost::fusion::result_of::convert</*...*/> /* ... */ "libs/log/src/settings_parser.cpp", line 209: Where: Instantiated from boost::log::v2s_mt_posix::parse_settings<char>(std::istream &). "libs/log/src/settings_parser.cpp", line 237: Where: Instantiated from non-template code. /* More errors afterward, but they appear to be repeats of existing errors */
The following change(s) will get rid of the errors:
208: #ifdef BOOST_LOG_USE_CHAR -209: template BOOST_LOG_SETUP_API basic_settings< char > parse_settings< char >/*...*/ +209: template<> BOOST_LOG_SETUP_API basic_settings< char > parse_settings< char >/*...*/ 210: #endif 211: #ifdef BOOST_LOG_USE_WCHAR_T -212: template BOOST_LOG_SETUP_API basic_settings< wchar_t > parse_settings< wchar_t >/*...*/ +212: template<> BOOST_LOG_SETUP_API basic_settings< wchar_t > parse_settings< wchar_t >/*...*/ 213: #endif
Change History (4)
comment:1 by , 9 years ago
Component: | None → log |
---|---|
Owner: | set to |
comment:2 by , 9 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:3 by , 9 years ago
I understand the need ... but if it's possible to still get changes submitted back for this, I may keep working on getting boost to build with this compiler.
Based on the error message, it looks like either:
- an implementation for
convert_impl<struct_tag>
is missing - the compiler wants different syntax somewhere between the instantiation of
parse_setting
(above) and the use ofconvert_impl<struct_tag>
.
I'm leaning toward (a); but if that's the case, why hasn't this been an issue on other compilers?
-Brian
comment:4 by , 9 years ago
In case it helps anyone, here's what I'm using to configure builds in Solaris:
# This is needed because the default for toolset=sun is stlport4 ~ gsed -i -e 's/stlport4/stdcxx4/g' tools/build/v2/tools/sun.jam # This is needed because a macro attempts to include from the stlport4 path ~ gsed -i -e 's/stlport4/stdcxx4/g' boost/tr1/detail/config_all.hpp ~ echo 'using sun : : /path/to/sunstudio/bin/CC : <cxxflags>"-features=tmplife,tmplrefstatic -template=no%extdef" ;' >> tools/build/v2/user-config.jam ~ ./bjam \ --without-{graph{,_parallel},math,wave,iostreams,context,coroutine} \ define={_GNU_SOURCE,BOOST_LOG_NO_MEMBER_TEMPLATE_FRIENDS} \ define={_XOPEN_SOURCE=500,__EXTENSIONS__,_XPG5,_POSIX_C_SOURCE=200112L} \ toolset=sun instruction-set=v9 address-model=32 \ --build-type=minimal -j20 -d+2
In the 2nd set of defines: the 1st two are needed to get boost::asio to build, the latter 2 avert other build problems introduced by the first two.
The suggested change is not correct. "template<>" prepends a full specialization of a template (making the code a forward declaration of a full specialization). "template", on the other hand, is a prefix for explicit instantiation of the template. This instantiation is required so that the generated code is present in the compiled binary and not discarded.
I tried this compiler locally on Linux and it failed in many respects, including problems with other libraries (Boost.Phoenix, AFAIR). For the amount of problems with this compiler I'm inclined to mark it as not supported. I've already added a note about it in the docs.