Boost 1.28 and compile failure in use_count_is_zero class
I am using the free C++Builder Compiler version 5.5.1 for Win32. (http://www.borland.com/products/downloads/download_cbuilder.html) I have used Boost 1.27 without problems, but when compiling the same code with Boost 1.28 I get this error message for the compiler: Error E2113 c:\borland\boost_1_28_0\boost/detail/shared_count.hpp 39: Virtual function 'use_count_is_zero::what() const throw()' conflicts with base class 'exception' The class use_count_is_zero (new in Boost 1.28) inherits from std::exception, and it seems like the method prototype for what() is different in the Borland include files and Boost. Boost: class use_count_is_zero: public std::exception { public: virtual char const * what() const throw() { return "use_count_is_zero"; } }; Borland, who seem to use STL from Rogue Wave Software: class _RWSTDExport exception { public: exception () _RWSTD_THROW_SPEC_NULL { ; } exception (const exception&) _RWSTD_THROW_SPEC_NULL { ; } #if defined(_MSC_VER) && !defined(__BORLANDC__) exception (const char *s) _RWSTD_THROW_SPEC_NULL { ; } #endif exception& operator= (const exception& e) _RWSTD_THROW_SPEC_NULL { return *this; } virtual ~exception () _RWSTD_THROW_SPEC_NULL; virtual const char * what () const _RWSTD_THROW_SPEC_NULL { return __RWSTD::__rw_stdexcept_NoNamedException; } }; The content of _RWSTD_THROW_SPEC_NULL is set in the file stdcomp.h, and it seems like it is empty for the Borland compiler, so I tried to copy the declaration from Borland like below, but got the same error. class use_count_is_zero: public std::exception { public: virtual const char * what () const _RWSTD_THROW_SPEC_NULL { return "use_count_is_zero"; } }; Any suggestions? \David
From: "david_at_2good"
I am using the free C++Builder Compiler version 5.5.1 for Win32. (http://www.borland.com/products/downloads/download_cbuilder.html)
I have used Boost 1.27 without problems, but when compiling the same code with Boost 1.28 I get this error message for the compiler:
Error E2113 c:\borland\boost_1_28_0\boost/detail/shared_count.hpp 39: Virtual function 'use_count_is_zero::what() const throw()' conflicts with base class 'exception'
Seems to work for me with the same compiler. Have you installed the service packs?
--- In Boost-Users@y..., "Peter Dimov"
From: "david_at_2good"
I am using the free C++Builder Compiler version 5.5.1 for Win32. (http://www.borland.com/products/downloads/download_cbuilder.html)
I have used Boost 1.27 without problems, but when compiling the same code with Boost 1.28 I get this error message for the compiler:
Error E2113 c:\borland\boost_1_28_0\boost/detail/shared_count.hpp 39: Virtual function 'use_count_is_zero::what() const throw()' conflicts with base class 'exception'
Seems to work for me with the same compiler. Have you installed the service packs?
Good idea! I didn't know there were any for the free compiler but I downloaded and installed them. No difference, though. But trying even harder, I examined the compiler flags used by the framework I use. The framework uses the Stdcall calling sequence for function calls by sending the -ps switch to the compiler. Without that switch, everything works fine. With the flag, the error above. Now I just have to figure out why this is a problem... hints, anyone? \David
From: "david_at_2good"
--- In Boost-Users@y..., "Peter Dimov"
wrote: From: "david_at_2good"
I am using the free C++Builder Compiler version 5.5.1 for Win32. (http://www.borland.com/products/downloads/download_cbuilder.html)
I have used Boost 1.27 without problems, but when compiling the same code with Boost 1.28 I get this error message for the compiler:
Error E2113 c:\borland\boost_1_28_0\boost/detail/shared_count.hpp 39: Virtual function 'use_count_is_zero::what() const throw()' conflicts with base class 'exception'
Seems to work for me with the same compiler. Have you installed the service packs?
Good idea! I didn't know there were any for the free compiler but I downloaded and installed them. No difference, though.
But trying even harder, I examined the compiler flags used by the framework I use. The framework uses the Stdcall calling sequence for function calls by sending the -ps switch to the compiler. Without that switch, everything works fine. With the flag, the error above. Now I just have to figure out why this is a problem... hints, anyone?
The reason is that <exception> (exceptio.h) contains #pragma option push -b -a8 -pc -Vx- -Ve- -w-inl -w-aus -w-sig as its first line, making standard-conformant code a bit difficult to compile under -ps. I can surround the use_count_is_zero definition with #pragma option push -pc, but is this the right thing to do?
From: "david_at_2good"
But trying even harder, I examined the compiler flags used by the framework I use. The framework uses the Stdcall calling sequence for function calls by sending the -ps switch to the compiler. Without
--- In Boost-Users@y..., "Peter Dimov"
switch, everything works fine. With the flag, the error above. Now I just have to figure out why this is a problem... hints, anyone?
The reason is that <exception> (exceptio.h) contains
#pragma option push -b -a8 -pc -Vx- -Ve- -w-inl -w-aus -w-sig
as its first line, making standard-conformant code a bit difficult to compile under -ps.
I can surround the use_count_is_zero definition with #pragma option push -pc, but is this the right thing to do?
I surrounded the place where I include boost/shared_ptr.hpp and boost/shared_array.hpp with the #pragma option push/pop. Not a very elegant solution, but it seems to do the trick. Surrounding the use_count_is_zero definition with the #pragmas would allow Boost to handle this case on its own, which is a Good Thing, but clutters the code with compiler-specific #ifdefs. Thank you very much for your help, David
participants (2)
-
david_at_2good
-
Peter Dimov