Skip to content

Commit e149b0e

Browse files
committed
copy constructors for exception classes
C++11 15.1 §5 requires that objects that are thrown have an accessible copy/move constructor and a destructor. This adds an explicit copy constructor to a few classes where the compiler cannot build the default copy constructor.
1 parent 953c677 commit e149b0e

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/ebmc/ebmc_error.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ Author: Daniel Kroening, dkr@amazon.com
1616
class ebmc_errort
1717
{
1818
public:
19+
ebmc_errort() = default;
20+
ebmc_errort(const ebmc_errort &other)
21+
{
22+
// ostringstream does not have a copy constructor
23+
message << other.message.str();
24+
__exit_code = other.__exit_code;
25+
__location = other.__location;
26+
}
27+
ebmc_errort(ebmc_errort &&) = default;
28+
1929
std::string what() const
2030
{
2131
return message.str();

src/verilog/verilog_preprocessor_error.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ Author: Daniel Kroening, kroening@kroening.com
1515
class verilog_preprocessor_errort
1616
{
1717
public:
18+
verilog_preprocessor_errort() = default;
19+
verilog_preprocessor_errort(verilog_preprocessor_errort &&) = default;
20+
verilog_preprocessor_errort(const verilog_preprocessor_errort &other)
21+
{
22+
// ostringstream does not have a copy constructor
23+
message << other.message.str();
24+
}
25+
1826
std::string what() const
1927
{
2028
return message.str();

0 commit comments

Comments
 (0)