[clang] [clang-tools-extra] [Clang][Sema] Clarify structured binding diagnostic when initializer is missing (PR #181803)

Giovanni B. via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 17 05:06:04 PST 2026


================
@@ -245,6 +245,10 @@ Improvements to Clang's diagnostics
 - The ``-Wloop-analysis`` warning has been extended to catch more cases of
   variable modification inside lambda expressions (#GH132038).
 
+- Improved the diagnostic for structured binding declarations missing an
+  initializer to tell the user what is expected (``=``, ``(``, or a braced
+  initializer list). (#GH90107)
----------------
Z3rox-dev wrote:

When a structured binding declaration has a stray token between the bindings and the initializer 
example : [auto [A, B] C = MyFunc(); 
clang emits decomposition declaration '[A, B]' requires an initializer which doesn't tell the user what syntax is actually expected. 
This patch appends the expected forms (=, (, or a braced initializer list) to make the diagnostic actionable. See #90107.

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


More information about the cfe-commits mailing list