This patch essentially reverts #108674 while adding a testcase that triggers a crash in clang-tidy. Fixes #108963.