From 40ce5d12c3d940639e59ccf03aca0b97b7b4ecf6 Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Thu, 13 Oct 2022 23:03:43 +0200 Subject: [PATCH] R.5 (scoped objects): Remove `auto` from Enforcement section (#1979) The enforcement rule on "an object is allocated and then deallocated on all paths" is not _specifically_ about objects declared by the `auto` keyword, and `auto` does not just mean "automatic storage duration" anymore. --- CppCoreGuidelines.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index 3ec39fa..69fe384 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -9562,7 +9562,7 @@ Instead, use a local variable: ##### Enforcement -* (Moderate) Warn if an object is allocated and then deallocated on all paths within a function. Suggest it should be a local `auto` stack object instead. +* (Moderate) Warn if an object is allocated and then deallocated on all paths within a function. Suggest it should be a local stack object instead. * (Simple) Warn if a local `Unique_pointer` or `Shared_pointer` is not moved, copied, reassigned or `reset` before its lifetime ends. ### R.6: Avoid non-`const` global variables