[program_options] patch to clear Borland regressions

The following patch clears the failures with the Borland compiler for the program options lib. Is this OK to commit or was there a specific reason why those functions were declared outside the class body? It shouldn't make any difference either which way, but you never know :-) While we're at it: the test program convert_test.cpp appears not to build with any compiler, and isn't currently being built by our test matrix? Regards, John. Index: boost/program_options/variables_map.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/program_options/variables_map.hpp,v retrieving revision 1.5.6.5 diff -u -r1.5.6.5 variables_map.hpp --- boost/program_options/variables_map.hpp 6 Jun 2006 14:30:28 -00001.5.6.5 +++ boost/program_options/variables_map.hpp 18 Oct 2006 11:39:29 -0000 @@ -57,10 +57,15 @@ /** If stored value if of type T, returns that value. Otherwise, throws boost::bad_any_cast exception. */ - template<class T> const T& as() const; - - /** @overload */ - template<class T> T& as(); + template<class T> + const T& as() const { + return boost::any_cast<const T&>(v); + } + // overload: + template<class T> + T& as() { + return boost::any_cast<T&>(v); + } /// Returns true if no value is stored. bool empty() const; @@ -185,18 +190,6 @@ return v; } - - template<class T> - const T& - variable_value::as() const { - return boost::any_cast<const T&>(v); - } - - template<class T> - T& - variable_value::as() { - return boost::any_cast<T&>(v); - } }} #endif

John Maddock wrote:
The following patch clears the failures with the Borland compiler for the program options lib. Is this OK to commit or was there a specific reason why those functions were declared outside the class body? It shouldn't make any difference either which way, but you never know :-)
No idea about the functionality of the patch, but you seem to have killed a special comment indicator. [snip]
- template<class T> const T& as() const; - - /** @overload */ -----------^^^^^^^^^^^^^^^^ - template<class T> T& as(); + template<class T> + const T& as() const { + return boost::any_cast<const T&>(v); + } + // overload: + template<class T> + T& as() { + return boost::any_cast<T&>(v); + }
[snip] Markus

Markus Schöpflin wrote:
John Maddock wrote:
The following patch clears the failures with the Borland compiler for the program options lib. Is this OK to commit or was there a specific reason why those functions were declared outside the class body? It shouldn't make any difference either which way, but you never know :-)
No idea about the functionality of the patch, but you seem to have killed a special comment indicator.
Well spotted! I'll reinstate that, before committing, if someone otherwise OK's the patch. Thanks, John.

John Maddock wrote:
The following patch clears the failures with the Borland compiler for the program options lib. Is this OK to commit or was there a specific reason why those functions were declared outside the class body? It shouldn't make any difference either which way, but you never know :-)
Looks fine, thanks for fixing this!
While we're at it: the test program convert_test.cpp appears not to build with any compiler, and isn't currently being built by our test matrix?
It's not built by our test matrix because I think it requires human to decide if the output is correct. I'll see if it still builds. - Volodya

Vladimir Prus wrote:
John Maddock wrote:
The following patch clears the failures with the Borland compiler for the program options lib. Is this OK to commit or was there a specific reason why those functions were declared outside the class body? It shouldn't make any difference either which way, but you never know :-)
Looks fine, thanks for fixing this!
OK applied to cvs HEAD and the release branch. Note however that cvs HEAD has other issues - that look to be related to changes in Boost.Bind - that prevent the tests passing with Borland's compiler. John.

John Maddock wrote:
Vladimir Prus wrote:
John Maddock wrote:
The following patch clears the failures with the Borland compiler for the program options lib. Is this OK to commit or was there a specific reason why those functions were declared outside the class body? It shouldn't make any difference either which way, but you never know :-)
Looks fine, thanks for fixing this!
OK applied to cvs HEAD and the release branch. Note however that cvs HEAD has other issues - that look to be related to changes in Boost.Bind - that prevent the tests passing with Borland's compiler.
CVS-HEAD isn't being tested against Borland, is it? Someone with access to a variety of Borland versions needs to try to replace bind.hpp line 937: #if 0 with #if defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, < 0x??? ) and report the correct value of 0x???. :-)

Peter Dimov wrote:
CVS-HEAD isn't being tested against Borland, is it?
Unfortunately not much is being tested on HEAD at present :-(
Someone with access to a variety of Borland versions needs to try to replace bind.hpp line 937:
#if 0
with
#if defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, < 0x??? )
and report the correct value of 0x???. :-)
It requires: #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) since the workaround is required with the latest compiler release. With that change all but two of the bind tests pass with Borland-5.8.2 and all the program options tests pass too. John.

John Maddock wrote:
Peter Dimov wrote:
CVS-HEAD isn't being tested against Borland, is it?
Unfortunately not much is being tested on HEAD at present :-(
Someone with access to a variety of Borland versions needs to try to replace bind.hpp line 937:
#if 0
with
#if defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, < 0x??? )
and report the correct value of 0x???. :-)
It requires:
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
since the workaround is required with the latest compiler release.
Thanks, done.
participants (4)
-
John Maddock
-
Markus Schöpflin
-
Peter Dimov
-
Vladimir Prus