diff options
author | Chris Lattner <sabre@nondot.org> | 2011-02-18 21:16:39 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-02-18 21:16:39 +0000 |
commit | febb5b884b1bb946b83800cb77cbea0119570d84 (patch) | |
tree | 400179903207b30c74d3cf2435a3c8425ac86cbc /lib/Parse/ParseExpr.cpp | |
parent | f4699d14b03d805ad9ccaa6288836ac2a8612925 (diff) |
fix rdar://9024687, a crash on invalid that we used to silently ignore.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125962 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseExpr.cpp')
-rw-r--r-- | lib/Parse/ParseExpr.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp index 84d77300eb..616c251583 100644 --- a/lib/Parse/ParseExpr.cpp +++ b/lib/Parse/ParseExpr.cpp @@ -794,6 +794,9 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, 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()); |