[clang] [Sema] Diagnose use of if/else-if condition variable inside else-if/else branch(s) (PR #156436)

via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 3 13:23:10 PDT 2025


================
@@ -0,0 +1,146 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wconditional-scope -DTEST_1 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wconditional-scope -DTEST_2 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wconditional-scope -DTEST_3 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wconditional-scope -DTEST_4 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wconditional-scope -DTEST_5 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wconditional-scope -DTEST_6 %s
+
+int *get_something();
+int *get_something_else();
+int *get_something_else_again();
+int *get_something_else_again_now();
+
+#ifdef TEST_1
----------------
arrowten wrote:

Do you mean to use one single function and all of the testcases together?

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


More information about the cfe-commits mailing list