1// RUN: %clang_cc1 -fsyntax-only -verify %s
2// RUN: %clang_cc1 -fsyntax-only -verify -std=gnu++98 %s
3// RUN: %clang_cc1 -fsyntax-only -verify -std=gnu++11 %s
4
5static void test() {
6  int *pi;
7  int x;
8  typeof pi[x] y;
9}
10
11// Part of rdar://problem/8347416;  from the gcc test suite.
12struct S {
13  int i;
14  __typeof(S::i) foo();
15#if __cplusplus <= 199711L
16  // expected-error@-2 {{invalid use of non-static data member 'i'}}
17#else
18  // expected-no-diagnostics
19#endif
20};
21