Preserve invalidity of typeof operands in C++.

llvm-svn: 111999
This commit is contained in:
John McCall 2010-08-24 23:41:43 +00:00
parent 45140a9040
commit 3669c80de9
2 changed files with 8 additions and 1 deletions

View File

@ -1166,7 +1166,8 @@ Parser::ParseExprAfterTypeofSizeofAlignof(const Token &OpTok,
// sizeof/alignof or in C++. Therefore, the parenthesized expression is
// the start of a unary-expression, but doesn't include any postfix
// pieces. Parse these now if present.
Operand = ParsePostfixExpressionSuffix(Operand.take());
if (!Operand.isInvalid())
Operand = ParsePostfixExpressionSuffix(Operand.get());
}
}

View File

@ -5,3 +5,9 @@ static void test() {
int x;
typeof pi[x] y;
}
// Part of rdar://problem/8347416; from the gcc test suite.
struct S {
int i;
__typeof(S::i) foo(); // expected-error {{invalid use of nonstatic data member 'i'}}
};