[clang] [Clang] Avoid null deref in lambda attribute compat warning (PR #161096)

Oleksandr T. via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 29 02:06:48 PDT 2025


================
@@ -1147,7 +1147,7 @@ def ext_lambda_missing_parens : ExtWarn<
   "lambda without a parameter clause is a C++23 extension">,
   InGroup<CXX23>;
 def warn_cxx20_compat_decl_attrs_on_lambda : Warning<
-  "%select{an attribute specifier sequence|%1}0 in this position "
+  "%select{an attribute specifier sequence|%0}1 in this position "
----------------
a-tarasyuk wrote:

@cor3ntin Thank you for the feedback. The current diagnostic uses two messages with mismatched formatting arguments. Should both be normalized to use `%0` for the selector and `%1` for the attr name?

https://github.com/llvm/llvm-project/blob/48a6f2f85c8269d8326c185016801a4eb8d5dfd6/clang/include/clang/Basic/DiagnosticParseKinds.td#L1143-L1145

https://github.com/llvm/llvm-project/blob/48a6f2f85c8269d8326c185016801a4eb8d5dfd6/clang/include/clang/Basic/DiagnosticParseKinds.td#L1149-L1152

Or should this mismatch simply be handled conditionally in C++ instead?

https://github.com/llvm/llvm-project/pull/161096


More information about the cfe-commits mailing list