From 33098ab31ee429eb0d42ece1b219c6685da99759 Mon Sep 17 00:00:00 2001 From: Neil MacIntosh Date: Mon, 20 Mar 2017 11:44:13 -0700 Subject: [PATCH] Updated guidance on noexcept on destructors (#814) --- CppCoreGuidelines.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index 337a211..aa88a77 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -4573,7 +4573,7 @@ If a destructor uses operations that may fail, it can catch exceptions and in so ##### Enforcement -(Simple) A destructor should be declared `noexcept`. +(Simple) A destructor should be declared `noexcept` if it could throw. ### C.37: Make destructors `noexcept` @@ -4583,11 +4583,11 @@ If a destructor uses operations that may fail, it can catch exceptions and in so ##### Note -A destructor (either user-defined or compiler-generated) is implicitly declared `noexcept` (independently of what code is in its body) if all of the members of its class have `noexcept` destructors. +A destructor (either user-defined or compiler-generated) is implicitly declared `noexcept` (independently of what code is in its body) if all of the members of its class have `noexcept` destructors. By explicitly marking destructors `noexcept`, an author guards against the destructor becoming implicitly `noexcept(false)` through the addition or modification of a class member. ##### Enforcement -(Simple) A destructor should be declared `noexcept`. +(Simple) A destructor should be declared `noexcept` if it could throw. ## C.ctor: Constructors