summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Parse/ParseExpr.cpp12
-rw-r--r--clang/lib/Parse/RAIIObjectsForParser.h5
2 files changed, 12 insertions, 5 deletions
diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp
index 2536cee1cbd..bdbc67f782d 100644
--- a/clang/lib/Parse/ParseExpr.cpp
+++ b/clang/lib/Parse/ParseExpr.cpp
@@ -565,9 +565,15 @@ Parser::OwningExprResult Parser::ParseCastExpression(bool isUnaryExpression,
TypeTy *CastTy;
SourceLocation LParenLoc = Tok.getLocation();
SourceLocation RParenLoc;
- Res = ParseParenExpression(ParenExprType, false/*stopIfCastExr*/,
- TypeOfCast, CastTy, RParenLoc);
- if (Res.isInvalid()) return move(Res);
+
+ {
+ // The inside of the parens don't need to be a colon protected scope.
+ ColonProtectionRAIIObject X(*this, false);
+
+ Res = ParseParenExpression(ParenExprType, false/*stopIfCastExr*/,
+ TypeOfCast, CastTy, RParenLoc);
+ if (Res.isInvalid()) return move(Res);
+ }
switch (ParenExprType) {
case SimpleExpr: break; // Nothing else to do.
diff --git a/clang/lib/Parse/RAIIObjectsForParser.h b/clang/lib/Parse/RAIIObjectsForParser.h
index 93b9a82fdca..d048f043413 100644
--- a/clang/lib/Parse/RAIIObjectsForParser.h
+++ b/clang/lib/Parse/RAIIObjectsForParser.h
@@ -48,8 +48,9 @@ namespace clang {
Parser &P;
bool OldVal;
public:
- ColonProtectionRAIIObject(Parser &p) : P(p), OldVal(P.ColonIsSacred) {
- P.ColonIsSacred = true;
+ ColonProtectionRAIIObject(Parser &p, bool Value = true)
+ : P(p), OldVal(P.ColonIsSacred) {
+ P.ColonIsSacred = Value;
}
/// restore - This can be used to restore the state early, before the dtor
OpenPOWER on IntegriCloud