return ExprError();
}
- if (!ResultType->isDependentType() &&
+ if (ResultType->isVoidType() && !getLangOptions().CPlusPlus) {
+ // GNU extension: subscripting on pointer to void
+ Diag(LLoc, diag::ext_gnu_void_ptr)
+ << BaseExpr->getSourceRange();
+ } else if (!ResultType->isDependentType() &&
RequireCompleteType(LLoc, ResultType,
PDiag(diag::err_subscript_incomplete_type)
<< BaseExpr->getSourceRange()))
// GNU extensions
typedef void (*FP)(void);
void *f2(void *a, int b) { return a + b; }
+void *f2_0(void *a, int b) { return &a[b]; }
void *f2_1(void *a, int b) { return (a += b); }
void *f3(int a, void *b) { return a + b; }
void *f3_1(int a, void *b) { return (a += b); }
FP f6_1(int a, FP b) { return (a += b); }
FP f7(FP a, int b) { return a - b; }
FP f7_1(FP a, int b) { return (a -= b); }
+void f8(void *a, int b) { return *(a + b); }
+void f8_1(void *a, int b) { return a[b]; }
c += 1; // expected-warning {{use of GNU void* extension}}
c--; // expected-warning {{use of GNU void* extension}}
c -= 1; // expected-warning {{use of GNU void* extension}}
+ (void) c[1]; // expected-warning {{use of GNU void* extension}}
b = 1+b; // expected-error {{arithmetic on pointer to incomplete type}}
/* The next couple tests are only pedantic warnings in gcc */
void (*d)(S*,void*) = a;