ggandda / simd-cxx

Automatically exported from code.google.com/p/simd-cxx
0 stars 0 forks source link

dds::Exception has no copy constructor #37

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. I want to integrate SimD exception classes to boost exception as introduced 
in 
http://www.boost.org/doc/libs/1_37_0/libs/exception/doc/tutorial_enable_error_in
fo.html, but it can't compile.

try {
  dds::Runtime runtime;
  ...
}
catch (dds::PostConditionViolation& ex) {
  throw boost::enable_error_info(ex);
}

The compile error (C2512) states boost\exception\exception.hpp(322): 
'dds::Exception::Exception' : no appropriate default constructor available. 
This really means, that it has no copy constructor.

What is the expected output? What do you see instead?
A copy constructor should be created for the dds::Exception class.

What version of the product are you using? On what operating system?
OpenSplice DDS Community 5.4.1; SimD 0.10; Boost 1.47.0; Visual Studio 2010 
Professional; Windows 7 Ultimate x64.

Please provide any additional information below.

If a copy constructor is added to the Exception class, it compiles and works 
with the following modification of the throw statement:

  throw boost::enable_error_info(static_cast<dds::Exception&>(ex));

Original issue reported on code.google.com by sczobor on 3 Jul 2012 at 9:44

GoogleCodeExporter commented 8 years ago
One more note: it compiles and works only in debug build, but generate 
std::bad_alloc exception in release builds. To get it work in release builds, 
templates used by std::string must have also been exported by adding the 
following two lines to exception.hpp (to global namespace):

template class SIMD_API std::allocator<char>;
template class SIMD_API std::basic_string<char, std::char_traits<char>, 
std::allocator<char>>;

Original comment by sczobor on 4 Jul 2012 at 10:43