From 227c9238a32154084d2453d214676f6c276d6af2 Mon Sep 17 00:00:00 2001 From: dh-04 Date: Wed, 29 Oct 2025 16:23:45 +0800 Subject: [PATCH] [NamespaceIndentation] constructor initializer list with {} should be allowed (#402) --- cpplint.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cpplint.py b/cpplint.py index ad942ba..2fce2f7 100755 --- a/cpplint.py +++ b/cpplint.py @@ -7292,10 +7292,11 @@ def ShouldCheckNamespaceIndentation( isinstance(nesting_state.stack[-1], _MemInitListInfo) or isinstance(nesting_state.popped_top, _MemInitListInfo) ) - ) or ( # popping constructor after MemInitList on the same line (: _a(a) {}) + ) or ( # popping constructor after MemInitList on the same line (: _a(a) {}) or (_a(a) {}) isinstance(nesting_state.previous_stack_top, _ConstructorInfo) and isinstance(nesting_state.popped_top, _ConstructorInfo) and re.search(r"[^:]:[^:]", raw_lines_no_comments[linenum]) + or re.search(r"^(?!.*:).*\)\s*\{?\s*\}$", raw_lines_no_comments[linenum]) ): return False