[all-commits] [llvm/llvm-project] 2d2498: No longer reject tag declarations in the clause-1 ...

Aaron Ballman via All-commits all-commits at lists.llvm.org
Fri Dec 18 05:00:55 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 2d2498ec6c42b12eae873257e6ddce3333fe8348
      https://github.com/llvm/llvm-project/commit/2d2498ec6c42b12eae873257e6ddce3333fe8348
  Author: Aaron Ballman <aaron at aaronballman.com>
  Date:   2020-12-18 (Fri, 18 Dec 2020)

  Changed paths:
    M clang/lib/Sema/SemaStmt.cpp
    M clang/test/Sema/for.c

  Log Message:
  -----------
  No longer reject tag declarations in the clause-1 of a for loop.

We currently reject this valid C construct by claiming it declares a
non-local variable: for (struct { int i; } s={0}; s.i != 0; s.i--) ;

We expected all declaration in the clause-1 declaration statement to be
a local VarDecl, but there can be other declarations involved such as a
tag declaration. This fixes PR35757.




More information about the All-commits mailing list