From 62585f7c38141126ae4d389014d3f7753f28eefa Mon Sep 17 00:00:00 2001 From: zhouronghua Date: Mon, 9 May 2022 16:35:39 +0800 Subject: [PATCH] bad default constructor compiled failed with clang: default constructor of 'Exception' is implicitly deleted because base class 'std::runtime_error' has no default constructor note: default constructor of 'InvalidOperationException' is implicitly deleted because base class '::gloo::Exception' has a deleted default constructor default constructor of 'IoException' is implicitly deleted because base class '::gloo::Exception' has a deleted default constructor --- gloo/common/error.h | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/gloo/common/error.h b/gloo/common/error.h index 1ac9fb5ef..51cdb4477 100644 --- a/gloo/common/error.h +++ b/gloo/common/error.h @@ -22,7 +22,11 @@ const std::chrono::milliseconds kNoTimeout = std::chrono::milliseconds::zero(); // A base class for all gloo runtime errors struct Exception : public std::runtime_error { - Exception() = default; + /* + default constructor of 'Exception' is implicitly deleted because + base class 'std::runtime_error' has no default constructor + */ + // Exception() = default; explicit Exception(const std::string& msg) : std::runtime_error(msg) {} }; @@ -32,7 +36,12 @@ struct Exception : public std::runtime_error { // Thrown for invalid operations on gloo APIs struct InvalidOperationException : public ::gloo::Exception { - InvalidOperationException() = default; + /* + note: default constructor of 'InvalidOperationException' is implicitly + deleted + because base class '::gloo::Exception' has a deleted default constructor + */ + // InvalidOperationException() = default; explicit InvalidOperationException(const std::string& msg) : ::gloo::Exception(msg) {} }; @@ -43,7 +52,11 @@ struct InvalidOperationException : public ::gloo::Exception { // Thrown for unrecoverable IO errors struct IoException : public ::gloo::Exception { - IoException() = default; + /* + default constructor of 'IoException' is implicitly deleted because + base class '::gloo::Exception' has a deleted default constructor + */ + // IoException() = default; explicit IoException(const std::string& msg) : ::gloo::Exception(msg) {} };