From 00690d0e89cee0d629acae9cbb0785adc444f92e Mon Sep 17 00:00:00 2001 From: Daniel Kroening Date: Sat, 20 Jul 2024 06:05:15 -0700 Subject: [PATCH] copy constructors for exception classes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/solvers/smt2/smt2_tokenizer.h | 9 +++++++++ src/util/typecheck.h | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/src/solvers/smt2/smt2_tokenizer.h b/src/solvers/smt2/smt2_tokenizer.h index d000053020a..a95fdcfb361 100644 --- a/src/solvers/smt2/smt2_tokenizer.h +++ b/src/solvers/smt2/smt2_tokenizer.h @@ -24,6 +24,15 @@ class smt2_tokenizert class smt2_errort { public: + smt2_errort(smt2_errort &&) = default; + + smt2_errort(const smt2_errort &other) + { + // ostringstream does not have a copy constructor + message << other.message.str(); + line_no = other.line_no; + } + smt2_errort(const std::string &_message, unsigned _line_no) : line_no(_line_no) { diff --git a/src/util/typecheck.h b/src/util/typecheck.h index c1ab8b4cd3d..5d09503766a 100644 --- a/src/util/typecheck.h +++ b/src/util/typecheck.h @@ -25,6 +25,15 @@ class typecheckt:public messaget class errort final { public: + errort() = default; + errort(errort &&) = default; + errort(const errort &other) + { + // ostringstream does not have a copy constructor + message << other.message.str(); + __location = other.__location; + } + std::string what() const { return message.str();