[all-commits] [llvm/llvm-project] 5b3ba2: [Clang] [Sema] Allow non-local/non-variable declar...

Sirraide via All-commits all-commits at lists.llvm.org
Wed Mar 5 17:03:43 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5b3ba261c49bee35debdd54e23a6a181126f798e
      https://github.com/llvm/llvm-project/commit/5b3ba261c49bee35debdd54e23a6a181126f798e
  Author: Sirraide <aeternalmail at gmail.com>
  Date:   2025-03-06 (Thu, 06 Mar 2025)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/lib/Sema/SemaStmt.cpp
    M clang/test/Sema/for.c

  Log Message:
  -----------
  [Clang] [Sema] Allow non-local/non-variable declarations in for loop (#129737)

Currently, we error on non-variable or non-local variable declarations
in `for` loops such as `for (struct S {}; 0; ) {}`. However, this is
valid in C23, so this patch changes the error to a compatibilty warning
and also allows this as an extension in earlier language modes. This
also matches GCC’s behaviour.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list