summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseExpr.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-10-19 22:04:39 +0000
committerDouglas Gregor <dgregor@apple.com>2009-10-19 22:04:39 +0000
commitc59e56190e918595916017171898368bdc89ef0d (patch)
treed901c0d6b51757e05a32a34f2e1a773bbf7dfbbe /clang/lib/Parse/ParseExpr.cpp
parentf264f8a21ca9b7e382442da9ed2e6fdc4c9fe27e (diff)
downloadbcm5719-llvm-c59e56190e918595916017171898368bdc89ef0d.tar.gz
bcm5719-llvm-c59e56190e918595916017171898368bdc89ef0d.zip
Parse a simple-template-id following a '~' when calling a destructor, e.g.,
t->~T<A0, A1>() Fixes PR5213. llvm-svn: 84545
Diffstat (limited to 'clang/lib/Parse/ParseExpr.cpp')
-rw-r--r--clang/lib/Parse/ParseExpr.cpp42
1 files changed, 35 insertions, 7 deletions
diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp
index 72e30e3b607..8be89a89168 100644
--- a/clang/lib/Parse/ParseExpr.cpp
+++ b/clang/lib/Parse/ParseExpr.cpp
@@ -972,13 +972,41 @@ Parser::ParsePostfixExpressionSuffix(OwningExprResult LHS) {
return ExprError();
}
- if (!LHS.isInvalid())
- LHS = Actions.ActOnDestructorReferenceExpr(CurScope, move(LHS),
- OpLoc, OpKind,
- Tok.getLocation(),
- Tok.getIdentifierInfo(),
- SS,
- NextToken().is(tok::l_paren));
+ if (NextToken().is(tok::less)) {
+ // class-name:
+ // ~ simple-template-id
+ TemplateTy Template
+ = Actions.ActOnDependentTemplateName(SourceLocation(),
+ *Tok.getIdentifierInfo(),
+ Tok.getLocation(),
+ SS,
+ ObjectType);
+ if (AnnotateTemplateIdToken(Template, TNK_Type_template, &SS,
+ SourceLocation(), true))
+ return ExprError();
+
+ assert(Tok.is(tok::annot_typename) &&
+ "AnnotateTemplateIdToken didn't work?");
+ if (!LHS.isInvalid())
+ LHS = Actions.ActOnDestructorReferenceExpr(CurScope, move(LHS),
+ OpLoc, OpKind,
+ Tok.getAnnotationRange(),
+ Tok.getAnnotationValue(),
+ SS,
+ NextToken().is(tok::l_paren));
+ } else {
+ // class-name:
+ // ~ identifier
+ if (!LHS.isInvalid())
+ LHS = Actions.ActOnDestructorReferenceExpr(CurScope, move(LHS),
+ OpLoc, OpKind,
+ Tok.getLocation(),
+ Tok.getIdentifierInfo(),
+ SS,
+ NextToken().is(tok::l_paren));
+ }
+
+ // Consume the identifier or template-id token.
ConsumeToken();
} else if (getLang().CPlusPlus && Tok.is(tok::kw_operator)) {
// We have a reference to a member operator, e.g., t.operator int or
OpenPOWER on IntegriCloud