[clang] [clang-tools-extra] [clang] Don't crash in HasSideEffects on a result-dependent _Generic (PR #248784)

Yousof Selim via cfe-commits cfe-commits at lists.llvm.org
Sun Dec 6 01:28:18 PST 2026


================
@@ -0,0 +1,9 @@
+// RUN: %check_clang_tidy -expect-clang-tidy-error %s misc-redundant-expression %t
----------------
yeegz wrote:

Added one in e6b12d8: a unit test in `clang/unittests/AST/ASTExprTest.cpp` that calls `HasSideEffects` on a `_Generic` whose controlling expression contains errors. It crashes without the fix. I couldn't find a lit test for plain clang: Sema checks dependence before calling `HasSideEffects` on every path I tried (`__builtin_assume`, `[[assume]]`, `sizeof`, `noexcept`, `typeid`, `&&`), so the crash only shows up through tools like clang-tidy.

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


More information about the cfe-commits mailing list