[clang-tools-extra] [clang-tidy] Prevent false-positive in presence of derived-to-base cast in bugprone.use-after-move (PR #189638)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 31 05:00:01 PDT 2026
github-actions[bot] wrote:
<!--PREMERGE ADVISOR COMMENT: Linux-->
# :penguin: Linux x64 Test Results
* 3176 tests passed
* 7 tests skipped
* 1 test failed
## Failed Tests
(click on a test name to see its output)
### Clang Tools
<details>
<summary>Clang Tools.clang-tidy/checkers/bugprone/use-after-move-derived-to-base.cpp</summary>
```
Exit Code: 1
Command Output (stdout):
--
# RUN: at line 1
/usr/bin/python3 /home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/test/../test/clang-tidy/check_clang_tidy.py -std=c++11,c++14 /home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/test/clang-tidy/checkers/bugprone/use-after-move-derived-to-base.cpp bugprone-use-after-move /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/bugprone/Output/use-after-move-derived-to-base.cpp.tmp
# executed command: /usr/bin/python3 /home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/test/../test/clang-tidy/check_clang_tidy.py -std=c++11,c++14 /home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/test/clang-tidy/checkers/bugprone/use-after-move-derived-to-base.cpp bugprone-use-after-move /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/bugprone/Output/use-after-move-derived-to-base.cpp.tmp
# .---command stdout------------
# | Running ['clang-tidy', '--experimental-custom-checks', '/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/bugprone/Output/use-after-move-derived-to-base.cpp.tmp.cpp', '-fix', '--checks=-*,bugprone-use-after-move', '--config={}', '--', '-std=c++11', '-nostdinc++', '-isystem', '/home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/test/../test/clang-tidy/checkers/Inputs/Headers/std']...
# | clang-tidy --experimental-custom-checks /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/bugprone/Output/use-after-move-derived-to-base.cpp.tmp.cpp -fix --checks=-*,bugprone-use-after-move --config={} -- -std=c++11 -nostdinc++ -isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/test/../test/clang-tidy/checkers/Inputs/Headers/std failed:
# | 2 warnings and 2 errors generated.
# | Error while processing /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/bugprone/Output/use-after-move-derived-to-base.cpp.tmp.cpp.
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/bugprone/Output/use-after-move-derived-to-base.cpp.tmp.cpp:21:5: error: expected class member or base class name [clang-diagnostic-error]
# | 21 | {
# | | ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/bugprone/Output/use-after-move-derived-to-base.cpp.tmp.cpp:22:17: warning: 'other' used after it was moved [bugprone-use-after-move]
# | 22 | std::move(other.a)
# | | ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/bugprone/Output/use-after-move-derived-to-base.cpp.tmp.cpp:20:5: note: move occurred here
# | 20 | A(std::move(other)),
# | | ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/bugprone/Output/use-after-move-derived-to-base.cpp.tmp.cpp:22:25: error: expected ';' after expression [clang-diagnostic-error]
# | 22 | std::move(other.a)
# | | ^
# | | ;
# | Suppressed 1 warnings (1 with check filters).
# | Found compiler errors, but -fix-errors was not specified.
# | Fixes have NOT been applied.
# |
# | Found compiler error(s).
# |
# `-----------------------------
# .---command stderr------------
# | Traceback (most recent call last):
# | File "/home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/test/../test/clang-tidy/check_clang_tidy.py", line 554, in <module>
# | main()
# | File "/home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/test/../test/clang-tidy/check_clang_tidy.py", line 550, in main
# | CheckRunner(args, extra_args).run()
# | File "/home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/test/../test/clang-tidy/check_clang_tidy.py", line 426, in run
# | clang_tidy_output = self.run_clang_tidy()
# | ^^^^^^^^^^^^^^^^^^^^^
# | File "/home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/test/../test/clang-tidy/check_clang_tidy.py", line 289, in run_clang_tidy
# | clang_tidy_output = try_run(args)
# | ^^^^^^^^^^^^^
# | File "/home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/test/../test/clang-tidy/check_clang_tidy.py", line 64, in try_run
# | process_output = subprocess.check_output(args, stderr=subprocess.STDOUT).decode(
# | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# | File "/usr/lib/python3.12/subprocess.py", line 466, in check_output
# | return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
# | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# | File "/usr/lib/python3.12/subprocess.py", line 571, in run
# | raise CalledProcessError(retcode, process.args,
# | subprocess.CalledProcessError: Command '['clang-tidy', '--experimental-custom-checks', '/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/bugprone/Output/use-after-move-derived-to-base.cpp.tmp.cpp', '-fix', '--checks=-*,bugprone-use-after-move', '--config={}', '--', '-std=c++11', '-nostdinc++', '-isystem', '/home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/test/../test/clang-tidy/checkers/Inputs/Headers/std']' returned non-zero exit status 1.
# `-----------------------------
# error: command failed with exit status: 1
--
```
</details>
If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.
https://github.com/llvm/llvm-project/pull/189638
More information about the cfe-commits
mailing list