[AST] Fix recovery-AST crash: dependent overloaded call exprs are now possible.

Reviewers: hokein

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D80154
This commit is contained in:
Sam McCall 2020-05-18 17:22:59 +02:00
parent e215cb7aa4
commit 1d579f54d7
2 changed files with 12 additions and 2 deletions

View File

@ -1446,7 +1446,6 @@ static Stmt::StmtClass DecodeOperatorCall(const CXXOperatorCallExpr *S,
case OO_Array_New:
case OO_Array_Delete:
case OO_Arrow:
case OO_Call:
case OO_Conditional:
case NUM_OVERLOADED_OPERATORS:
llvm_unreachable("Invalid operator call kind");
@ -1620,6 +1619,9 @@ static Stmt::StmtClass DecodeOperatorCall(const CXXOperatorCallExpr *S,
case OO_Subscript:
return Stmt::ArraySubscriptExprClass;
case OO_Call:
return Stmt::CallExprClass;
case OO_Coawait:
UnaryOp = UO_Coawait;
return Stmt::UnaryOperatorClass;
@ -1660,7 +1662,7 @@ void StmtProfiler::VisitCXXOperatorCallExpr(const CXXOperatorCallExpr *S) {
SC == Stmt::CompoundAssignOperatorClass)
ID.AddInteger(BinaryOp);
else
assert(SC == Stmt::ArraySubscriptExprClass);
assert(SC == Stmt::ArraySubscriptExprClass || SC == Stmt::CallExprClass);
return;
}

View File

@ -177,3 +177,11 @@ void InitializerForAuto() {
// CHECK: `-VarDecl {{.*}} invalid unresolved_typo 'auto'
auto unresolved_typo = gned.*[] {};
}
// CHECK: `-TypeAliasDecl {{.*}} Escape 'decltype([] {
// CHECK-NEXT: return <recovery-expr>(undef);
// CHECK-NEXT: }())'
// CHECK-NEXT: `-DecltypeType {{.*}} 'decltype([] {
// CHECK-NEXT: return <recovery-expr>(undef);
// CHECK-NEXT: }())' dependent
using Escape = decltype([] { return undef(); }());