[constrained-value] with 1.43.0

I found my code using constrained_value compiles with boost-1.42.0, but not with 1.43.0. Rather mysterious error message: /usr/local/src/boost.hg/boost/constrained_value/constrained.hpp:64: error: 'template<class ExceptionType> struct boost::constrained_value::throw_exception' is not a function, /usr/local/src/boost.hg/boost/throw_exception.hpp:74: error: conflict with 'template<class E> void boost::throw_exception(const E&)' /usr/local/src/boost.hg/boost/throw_exception.hpp:54: error: in call to 'throw_exception' scons: *** [mod/fixed_pt.os] Error 1

----- Original Message ----- From: "Neal Becker" <ndbecker2@gmail.com> To: <boost@lists.boost.org> Sent: Thursday, May 06, 2010 4:57 PM Subject: [boost] [constrained-value] with 1.43.0
I found my code using constrained_value compiles with boost-1.42.0, but not with 1.43.0. Rather mysterious error message:
/usr/local/src/boost.hg/boost/constrained_value/constrained.hpp:64: error: 'template<class ExceptionType> struct boost::constrained_value::throw_exception' is not a function, /usr/local/src/boost.hg/boost/throw_exception.hpp:74: error: conflict with 'template<class E> void boost::throw_exception(const E&)' /usr/local/src/boost.hg/boost/throw_exception.hpp:54: error: in call to 'throw_exception' scons: *** [mod/fixed_pt.os] Error 1
Have you using namespace statements, such as using namespace boost::constrained_value; or using namespace boost; Best, Vicente

vicente.botet wrote:
----- Original Message ----- From: "Neal Becker" <ndbecker2@gmail.com> To: <boost@lists.boost.org> Sent: Thursday, May 06, 2010 4:57 PM Subject: [boost] [constrained-value] with 1.43.0
I found my code using constrained_value compiles with boost-1.42.0, but not with 1.43.0. Rather mysterious error message:
/usr/local/src/boost.hg/boost/constrained_value/constrained.hpp:64: error: 'template<class ExceptionType> struct boost::constrained_value::throw_exception' is not a function, /usr/local/src/boost.hg/boost/throw_exception.hpp:74: error: conflict with 'template<class E> void boost::throw_exception(const E&)' /usr/local/src/boost.hg/boost/throw_exception.hpp:54: error: in call to 'throw_exception' scons: *** [mod/fixed_pt.os] Error 1
Have you using namespace statements, such as
using namespace boost::constrained_value;
or
using namespace boost;
Best, Vicente No, no using namespace.

----- Original Message ----- From: "Neal Becker" <ndbecker2@gmail.com> To: <boost@lists.boost.org> Sent: Thursday, May 06, 2010 4:57 PM Subject: [boost] [constrained-value] with 1.43.0
I found my code using constrained_value compiles with boost-1.42.0, but not with 1.43.0. Rather mysterious error message:
/usr/local/src/boost.hg/boost/constrained_value/constrained.hpp:64: error: 'template<class ExceptionType> struct boost::constrained_value::throw_exception' is not a function, /usr/local/src/boost.hg/boost/throw_exception.hpp:74: error: conflict with 'template<class E> void boost::throw_exception(const E&)' /usr/local/src/boost.hg/boost/throw_exception.hpp:54: error: in call to 'throw_exception' scons: *** [mod/fixed_pt.os] Error 1
The following code has been introduced in 1.43. Can you can move it to the end of the file and checkagain (it is using throw_exception which is not yet declared). HTH, Vicente #if !defined( BOOST_EXCEPTION_DISABLE ) namespace exception_detail { template <class E> void throw_exception_( E const & x, char const * current_function, char const * file, int line ) { throw_exception( set_info( set_info( set_info( enable_error_info(x), throw_function(current_function)), throw_file(file)), throw_line(line))); } } #endif

On Thu, May 6, 2010 at 10:55 AM, vicente.botet <vicente.botet@wanadoo.fr> wrote:
----- Original Message ----- The following code has been introduced in 1.43. Can you can move it to the end of the file and checkagain (it is using throw_exception which is not yet declared).
HTH, Vicente
#if !defined( BOOST_EXCEPTION_DISABLE ) namespace exception_detail { template <class E> void throw_exception_( E const & x, char const * current_function, char const * file, int line ) { throw_exception( set_info( set_info( set_info( enable_error_info(x), throw_function(current_function)), throw_file(file)), throw_line(line))); } } #endif
Which compiler is this? Does moving the code solve the problem? Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode

Emil Dotchevski wrote:
On Thu, May 6, 2010 at 10:55 AM, vicente.botet <vicente.botet@wanadoo.fr> wrote:
----- Original Message ----- The following code has been introduced in 1.43. Can you can move it to the end of the file and checkagain (it is using throw_exception which is not yet declared).
HTH, Vicente
#if !defined( BOOST_EXCEPTION_DISABLE ) namespace exception_detail { template <class E> void throw_exception_( E const & x, char const * current_function, char const * file, int line ) { throw_exception( set_info( set_info( set_info( enable_error_info(x), throw_function(current_function)), throw_file(file)), throw_line(line))); } } #endif
Which compiler is this? Does moving the code solve the problem?
gcc-4.4.3-4.fc12.x86_64 No, moving that code doesn't fix it. Still very mysterious. The claim is that template <typename ExceptionType = broken_constraint> struct throw_exception in constrained.hpp conflicts with template<class E> BOOST_ATTRIBUTE_NORETURN inline void throw_exception( E const & e ) in throw_exception.hpp in call to 'throw_exception' in the code we just moved, but the throw_exception in constrained.hpp is in namespace boost { /// The Boost Constrained Value library's namespace. namespace constrained_value { namespace, so I don't see how it conflicts. If someone wants to try it, I put the 2 files here: http://nbecker.dyndns.org:8080/boost/

I don't understand why, but this patch will disambiguate the call to throw_exception and quiet gcc, move definition later in file + qualify call to boost::throw_exception diff -r 547ea1f75944 boost/throw_exception.hpp --- a/boost/throw_exception.hpp Wed May 05 20:24:10 2010 -0400 +++ b/boost/throw_exception.hpp Fri May 07 20:18:18 2010 -0400 @@ -43,25 +43,6 @@ namespace boost { -#if !defined( BOOST_EXCEPTION_DISABLE ) - namespace - exception_detail - { - template <class E> - void - throw_exception_( E const & x, char const * current_function, char const * file, int line ) - { - throw_exception( - set_info( - set_info( - set_info( - enable_error_info(x), - throw_function(current_function)), - throw_file(file)), - throw_line(line))); - } - } -#endif #ifdef BOOST_NO_EXCEPTIONS @@ -86,6 +67,26 @@ #endif +#if !defined( BOOST_EXCEPTION_DISABLE ) + namespace + exception_detail + { + template <class E> + void + throw_exception_( E const & x, char const * current_function, char const * file, int line ) + { + boost::throw_exception( + set_info( + set_info( + set_info( + enable_error_info(x), + throw_function(current_function)), + throw_file(file)), + throw_line(line))); + } + } +#endif + } // namespace boost

That's fine, please confirm that it works, see revision 61852. Thanks, Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode On Fri, May 7, 2010 at 5:19 PM, Neal Becker <ndbecker2@gmail.com> wrote:
I don't understand why, but this patch will disambiguate the call to throw_exception and quiet gcc, move definition later in file + qualify call to boost::throw_exception
diff -r 547ea1f75944 boost/throw_exception.hpp --- a/boost/throw_exception.hpp Wed May 05 20:24:10 2010 -0400 +++ b/boost/throw_exception.hpp Fri May 07 20:18:18 2010 -0400 @@ -43,25 +43,6 @@
namespace boost { -#if !defined( BOOST_EXCEPTION_DISABLE ) - namespace - exception_detail - { - template <class E> - void - throw_exception_( E const & x, char const * current_function, char const * file, int line ) - { - throw_exception( - set_info( - set_info( - set_info( - enable_error_info(x), - throw_function(current_function)), - throw_file(file)), - throw_line(line))); - } - } -#endif
#ifdef BOOST_NO_EXCEPTIONS
@@ -86,6 +67,26 @@
#endif
+#if !defined( BOOST_EXCEPTION_DISABLE ) + namespace + exception_detail + { + template <class E> + void + throw_exception_( E const & x, char const * current_function, char const * file, int line ) + { + boost::throw_exception( + set_info( + set_info( + set_info( + enable_error_info(x), + throw_function(current_function)), + throw_file(file)), + throw_line(line))); + } + } +#endif + } // namespace boost
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Not sure what you mean by 'please confirm that it works'. The patch I sent allows my code to compile OK.
participants (3)
-
Emil Dotchevski
-
Neal Becker
-
vicente.botet