fix rdar://9024687, a crash on invalid that we used to silently ignore.
llvm-svn: 125962
diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp
index 84d7730..616c251 100644
--- a/clang/lib/Parse/ParseExpr.cpp
+++ b/clang/lib/Parse/ParseExpr.cpp
@@ -794,6 +794,9 @@
if (Tok.isNot(tok::identifier))
return ExprError(Diag(Tok, diag::err_expected_ident));
+ if (getCurScope()->getFnParent() == 0)
+ return ExprError(Diag(Tok, diag::err_address_of_label_outside_fn));
+
Diag(AmpAmpLoc, diag::ext_gnu_address_of_label);
LabelDecl *LD = Actions.LookupOrCreateLabel(Tok.getIdentifierInfo(),
Tok.getLocation());