// Reject array indices starting with a lambda-expression. '[[' is
// reserved for attributes.
- if (CheckProhibitedCXX11Attribute())
+ if (CheckProhibitedCXX11Attribute()) {
+ (void)Actions.CorrectDelayedTyposInExpr(LHS);
return ExprError();
+ }
BalancedDelimiterTracker T(*this, tok::l_square);
T.consumeOpen();
SourceLocation RLoc = Tok.getLocation();
+ ExprResult OrigLHS = LHS;
if (!LHS.isInvalid() && !Idx.isInvalid() && !Length.isInvalid() &&
Tok.is(tok::r_square)) {
if (ColonLoc.isValid()) {
Idx.get(), RLoc);
}
} else {
- (void)Actions.CorrectDelayedTyposInExpr(LHS);
+ LHS = ExprError();
+ }
+ if (LHS.isInvalid()) {
+ (void)Actions.CorrectDelayedTyposInExpr(OrigLHS);
(void)Actions.CorrectDelayedTyposInExpr(Idx);
(void)Actions.CorrectDelayedTyposInExpr(Length);
LHS = ExprError();
int : 0 | // expected-error {{invalid operands to binary expression}}
(struct B0)e; // expected-error {{use of undeclared identifier}}
};
+
+namespace {
+struct a0is0 {};
+struct b0is0 {};
+int g() {
+ 0 [ // expected-error {{subscripted value is not an array}}
+ sizeof(c0is0)]; // expected-error {{use of undeclared identifier}}
+};
+}