[clang] [clang] more useful error message for decomposition declaration missing initializer (PR #127924)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 29 08:51:57 PDT 2026
AaronBallman wrote:
Precommit CI failures are related:
```
FAIL: Clang Tools :: clang-tidy/checkers/misc/misplaced-const-cxx17.cpp (862 of 1576)
******************** TEST 'Clang Tools :: clang-tidy/checkers/misc/misplaced-const-cxx17.cpp' FAILED ********************
Exit Code: 1
Command Output (stdout):
--
# RUN: at line 1
C:/Python312/python.exe C:/_work/llvm-project/llvm-project/clang-tools-extra/test/../test\clang-tidy\check_clang_tidy.py -std=c++17-or-later -expect-clang-tidy-error C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\checkers\misc\misplaced-const-cxx17.cpp misc-misplaced-const C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\misc\Output\misplaced-const-cxx17.cpp.tmp
# executed command: C:/Python312/python.exe 'C:/_work/llvm-project/llvm-project/clang-tools-extra/test/../test\clang-tidy\check_clang_tidy.py' -std=c++17-or-later -expect-clang-tidy-error 'C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\checkers\misc\misplaced-const-cxx17.cpp' misc-misplaced-const 'C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\misc\Output\misplaced-const-cxx17.cpp.tmp'
# .---command stdout------------
# | Running ['not', 'clang-tidy', '--experimental-custom-checks', 'C:\\_work\\llvm-project\\llvm-project\\build\\tools\\clang\\tools\\extra\\test\\clang-tidy\\checkers\\misc\\Output\\misplaced-const-cxx17.cpp.tmp.cpp', '-fix', '--checks=-*,misc-misplaced-const', '--config={}', '--', '-std=c++17', '-nostdinc++', '-isystem', 'C:\\_work\\llvm-project\\llvm-project\\clang-tools-extra\\test\\clang-tidy\\checkers\\Inputs\\Headers\\std']...
# | ------------------------ clang-tidy output -----------------------
# | 1 error generated.
# |
# | Error while processing C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\misc\Output\misplaced-const-cxx17.cpp.tmp.cpp.
# |
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\misc\Output\misplaced-const-cxx17.cpp.tmp.cpp:7:9: error: structured binding declaration '[x]' requires an initializer; expected '=' or braced initializer list [clang-diagnostic-error]
# | 7 | auto [x];
# | | ^
# | Input was:
# |
# | <<<<<<
# |
# | 1: 1 error generated.
# |
# |
# | check:6'0 { search range start (exclusive)
# |
# | check:6'1 error: no match found in search range
# |
# | check:6'2 with "@LINE+1" equal to "7"
# |
# | 2: Error while processing C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\misc\Output\misplaced-const-cxx17.cpp.tmp.cpp.
# |
# |
# | 3: C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\misc\Output\misplaced-const-cxx17.cpp.tmp.cpp:7:9: error: structured binding declaration '[x]' requires an initializer; expected '=' or braced initializer list [clang-diagnostic-error]
# |
# | check:6'3 ? possible intended match
# |
# | 4: 7 | auto [x];
# |
# | 5: | ^
# |
# | 6: Found compiler errors, but -fix-errors was not specified.
# |
# |
# | 7: Fixes have NOT been applied.
# |
# |
# | 8:
# |
# |
# | 9: Found compiler error(s).
# |
# |
# | check:6'4 } search range end (exclusive)
# |
# | >>>>>>
# |
# |
# `-----------------------------
# .---command stderr------------
# | Traceback (most recent call last):
# | File "C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 558, in <module>
# | main()
# | File "C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 554, in main
# | CheckRunner(args, extra_args).run()
# | File "C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 433, in run
# | self.check_messages(main_output)
# | File "C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 358, in check_messages
# | try_run(
# | File "C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 64, in try_run
# | process_output = subprocess.check_output(args, stderr=subprocess.STDOUT).decode(
# | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# | File "c:\python312\Lib\subprocess.py", line 466, in check_output
# | return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
# | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# | File "c:\python312\Lib\subprocess.py", line 571, in run
# | raise CalledProcessError(retcode, process.args,
# | subprocess.CalledProcessError: Command '['FileCheck', '-input-file=C:\\_work\\llvm-project\\llvm-project\\build\\tools\\clang\\tools\\extra\\test\\clang-tidy\\checkers\\misc\\Output\\misplaced-const-cxx17.cpp.tmp.cpp.msg', 'C:\\_work\\llvm-project\\llvm-project\\clang-tools-extra\\test\\clang-tidy\\checkers\\misc\\misplaced-const-cxx17.cpp', '-check-prefixes=CHECK-MESSAGES', '-implicit-check-not={{warning|error}}:']' returned non-zero exit status 1.
# `-----------------------------
# error: command failed with exit status: 1
--
********************
```
https://github.com/llvm/llvm-project/pull/127924
More information about the cfe-commits
mailing list