aboutsummaryrefslogtreecommitdiff
path: root/clang/test/Parser/gcc-for-loop-init-compatibility.c
blob: 8bf439d935f8e8a3dc52716d37c2cd6be06b9c0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// RUN: %clang_cc1 -std=c89 -fsyntax-only -verify %s
// RUN: %clang_cc1 -std=gnu89 -fsyntax-only -verify %s
// RUN: %clang_cc1 -std=c99 -fsyntax-only -verify %s -DC99

#ifdef C99
// expected-no-diagnostics
#endif

void foo(void) {
#ifndef C99
  // expected-warning@+2{{GCC does not allow variable declarations in for loop initializers before C99}}
#endif
  for (int i = 0; i < 10; i++)
    ;
}