aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Parse/ParseExpr.cpp3
-rw-r--r--test/Parser/cxx-typeof.cpp6
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp
index c42fdecd7e..7020fa412e 100644
--- a/lib/Parse/ParseExpr.cpp
+++ b/lib/Parse/ParseExpr.cpp
@@ -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());
}
}
diff --git a/test/Parser/cxx-typeof.cpp b/test/Parser/cxx-typeof.cpp
index 7e891013e9..4c598e9517 100644
--- a/test/Parser/cxx-typeof.cpp
+++ b/test/Parser/cxx-typeof.cpp
@@ -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'}}
+};