<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/69863>69863</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy-17] ICE in `clang::tidy::modernize::UseTrailingReturnTypeCheck::check`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang,
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
vsytch
</td>
</tr>
</table>
<pre>
Crash backtrace:
```
[main] Building folder: cxx-init
[main] Configuring project: cxx-init
[proc] Executing command: /usr/bin/cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON "-DCMAKE_CONFIGURATION_TYPES=Release;RelWithDebInfo;Debug" -DCMAKE_CROSS_CONFIGS=all -DCMAKE_DEFAULT_BUILD_TYPE=RelWithDebInfo -DCMAKE_DEFAULT_CONFIGS=RelWithDebInfo -DCMAKE_TOOLCHAIN_FILE=/opt/vcpkg-2023.08.09/scripts/buildsystems/vcpkg.cmake "-DCMAKE_CXX_CPPCHECK=cppcheck;--enable=all" "-DCMAKE_CXX_CLANG_TIDY=clang-tidy;--header-filter=^/workspaces/cxx-init/" -DCMAKE_CXX_EXTENSIONS=OFF -DCMAKE_CXX_STANDARD=23 -DCMAKE_CXX_STANDARD_REQUIRED=ON "-DCMAKE_CXX_FLAGS=-Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wcast-qual -Wformat=2 -Wundef -Werror=float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wimplicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wold-style-cast" -S/workspaces/cxx-init -B/workspaces/cxx-init/build -G "Ninja Multi-Config"
[cmake] -- Configuring done (0.0s)
[cmake] -- Generating done (0.0s)
[cmake] -- Build files have been written to: /workspaces/cxx-init/build
[build] Starting build
[proc] Executing command: /usr/bin/cmake --build /workspaces/cxx-init/build --config Release --target main
[build] [1/2] Building CXX object CMakeFiles/main.dir/Release/src/main.cpp.o
[build] FAILED: CMakeFiles/main.dir/Release/src/main.cpp.o
[build] /usr/bin/cmake -E __run_co_compile --tidy="clang-tidy;--header-filter=^/workspaces/cxx-init/;--extra-arg-before=--driver-mode=g++" --cppcheck="cppcheck;--enable=all" --source=/workspaces/cxx-init/src/main.cpp -- /usr/bin/c++ -DCMAKE_INTDIR=\"Release\" -isystem /opt/vcpkg-2023.08.09/installed/x64-linux/include -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wcast-qual -Wformat=2 -Wundef -Werror=float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wimplicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wold-style-cast -O3 -DNDEBUG -std=c++23 -MD -MT CMakeFiles/main.dir/Release/src/main.cpp.o -MF CMakeFiles/main.dir/Release/src/main.cpp.o.d -o CMakeFiles/main.dir/Release/src/main.cpp.o -c /workspaces/cxx-init/src/main.cpp
[build] Error running 'clang-tidy': PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
[build] Stack dump:
[build] 0. Program arguments: clang-tidy --header-filter=^/workspaces/cxx-init/ --extra-arg-before=--driver-mode=g++ /workspaces/cxx-init/src/main.cpp -- /usr/bin/c++ -DCMAKE_INTDIR=\"Release\" -isystem /opt/vcpkg-2023.08.09/installed/x64-linux/include -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wcast-qual -Wformat=2 -Wundef -Werror=float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wimplicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wold-style-cast -O3 -DNDEBUG -std=c++23 -MD -MT CMakeFiles/main.dir/Release/src/main.cpp.o -MF CMakeFiles/main.dir/Release/src/main.cpp.o.d -o CMakeFiles/main.dir/Release/src/main.cpp.o -c /workspaces/cxx-init/src/main.cpp
[build] 1. <eof> parser at end of file
[build] 2. ASTMatcher: Processing 'modernize-use-trailing-return-type' against:
[build] FunctionDecl stdexec::operator""__csz : </usr/local/include/stdexec/__detail/__meta.hpp:167:3, line:169:3>
[build] --- Bound Nodes Begin ---
[build] Func - { FunctionDecl stdexec::operator""__csz : </usr/local/include/stdexec/__detail/__meta.hpp:167:3, line:169:3> }
[build] --- Bound Nodes End ---
[build] Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
[build] 0 libLLVM-17.so.1 0x00007f2cac5331b6 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 54
[build] 1 libLLVM-17.so.1 0x00007f2cac531360 llvm::sys::RunSignalHandlers() + 80
[build] 2 libLLVM-17.so.1 0x00007f2cac53384b
[build] 3 libc.so.6 0x00007f2cab301520
[build] 4 clang-tidy 0x000055f623468261
[build] 5 clang-tidy 0x000055f62345c60f
[build] 6 clang-tidy 0x000055f62345b466
[build] 7 clang-tidy 0x000055f62345a0a9
[build] 8 clang-tidy 0x000055f623459f4c
[build] 9 clang-tidy 0x000055f62345962d clang::tidy::modernize::UseTrailingReturnTypeCheck::check(clang::ast_matchers::MatchFinder::MatchResult const&) + 1149
[build] 10 clang-tidy 0x000055f6238257cb
[build] 11 clang-tidy 0x000055f62385661c clang::ast_matchers::internal::BoundNodesTreeBuilder::visitMatches(clang::ast_matchers::internal::BoundNodesTreeBuilder::Visitor*) + 172
[build] 12 clang-tidy 0x000055f623825163
[build] 13 clang-tidy 0x000055f623827aab
[build] 14 clang-tidy 0x000055f62382b2db
[build] 15 clang-tidy 0x000055f623827da9
[build] 16 clang-tidy 0x000055f623829d6b
[build] 17 clang-tidy 0x000055f623827c71
[build] 18 clang-tidy 0x000055f6238303ab
[build] 19 clang-tidy 0x000055f6238282bf
[build] 20 clang-tidy 0x000055f6237fa438 clang::ast_matchers::MatchFinder::matchAST(clang::ASTContext&) + 728
[build] 21 libclang-cpp.so.17 0x00007f2cb56a755c clang::MultiplexConsumer::HandleTranslationUnit(clang::ASTContext&) + 44
[build] 22 libclang-cpp.so.17 0x00007f2cb394ae06 clang::ParseAST(clang::Sema&, bool, bool) + 614
[build] 23 libclang-cpp.so.17 0x00007f2cb566c7d5 clang::FrontendAction::Execute() + 85
[build] 24 libclang-cpp.so.17 0x00007f2cb55e7c94 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 708
[build] 25 libclang-cpp.so.17 0x00007f2cb58edcd7 clang::tooling::FrontendActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) + 423
[build] 26 clang-tidy 0x000055f623df1f88
[build] 27 libclang-cpp.so.17 0x00007f2cb58eda14 clang::tooling::ToolInvocation::runInvocation(char const*, clang::driver::Compilation*, std::shared_ptr<clang::CompilerInvocation>, std::shared_ptr<clang::PCHContainerOperations>) + 276
[build] 28 libclang-cpp.so.17 0x00007f2cb58ec7d4 clang::tooling::ToolInvocation::run() + 1412
[build] 29 libclang-cpp.so.17 0x00007f2cb58ef26f clang::tooling::ClangTool::run(clang::tooling::ToolAction*) + 3679
[build] 30 clang-tidy 0x000055f623dee2e1 clang::tidy::runClangTidy(clang::tidy::ClangTidyContext&, clang::tooling::CompilationDatabase const&, llvm::ArrayRef<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem>, bool, bool, llvm::StringRef) + 1057
[build] 31 clang-tidy 0x000055f6230ee414 clang::tidy::clangTidyMain(int, char const**) + 10724
[build] 32 libc.so.6 0x00007f2cab2e8d90
[build] 33 libc.so.6 0x00007f2cab2e8e40 __libc_start_main + 128
[build] 34 clang-tidy 0x000055f6230e9775 _start + 37
[build] Segmentation fault
[build] ninja: build stopped: subcommand failed.
[proc] The command: /usr/bin/cmake --build /workspaces/cxx-init/build --config Release --target main exited with code: 1
[driver] Build completed: 00:00:02.586
[build] Build finished with exit code 1
```
Example:
```
#include <fmt/core.h>
#include <stdexec/execution.hpp>
#include <exec/task.hpp>
#include <coroutine>
#include <mutex>
struct async_lock_awaiter {
async_lock_awaiter(std::mutex& m): m(m) {}
bool await_ready() { return m.try_lock(); }
void await_suspend(std::coroutine_handle<>) {}
void await_resume() {}
std::mutex& m;
};
template<typename Lockable>
auto async_lock(Lockable& lock)
-> exec::task<void> {
co_await async_lock_awaiter{lock};
co_return;
}
std::mutex m;
auto main() -> int {
using namespace fmt;
stdexec::sync_wait(async_lock(m));
std::lock_guard<std::mutex> lg(m, std::adopt_lock);
print("Hello world\n");
return 0;
}
```
Build environment: https://github.com/vsytch/cxx-init/blob/main/.devcontainer/Dockerfile
* clang version 17
* stdexec @ `nvhpc-23.09.rc4`
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWk9z4rqW_zTKRmXKlsGGRRZgoJt6-TcJ_ZI3G5eQj0E3RvJIMp3cTz8lGYMJTujbb2rqLW4qlWDr_NfR7xxJUK35WgBco8EEDaZXtDIbqa53-t2wzdVKZu_XiaJ6g1eUvRpFGaBwjPwp8sco8ve_9eNgsqVcoMEUTypeZFyscS6LDBQKx5i9vXlccIPPiBMpcr6ulKUvlfwDmOlmKJVklmH2BqwylpzJ7ZaKzJIjMq-0QmS-4gKROdvSV8DeNLkd_2OWzl4e7h-XaXJ_-7C4mdn_t-O76RMKp_d3GBHS0CX3d_PFtx-P4-Xi_i5d_uthZmkeoQCqAYWTRyieudlMYbUQuUThZAqrao0IOWhKHu-fnvZyLC8tisPYdDYf_7hZppMfi5upk14Lb4k8oz1K-oRweX9_k3wfL-7S-eLGCkRkLkuDyHzHyte1R3wS9vxhzx8hMtdM8dJoGyU7Q_pdG9jqhrZXB60dj5eXNHl4SL7Pkn-gcMrKkm2AvaJw4nkg6KqA2kUbgY9sN-O7b-lyMf2XZSyoWHuGZ--OdQM0A-XlvDA2OaZoMENk_lOqV11SBtagZvYRmZ-E9-Ul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