Skip to content

Commit

Permalink
[AST][RecoveryExpr] Fix the missing type when rebuilding RecoveryExpr…
Browse files Browse the repository at this point in the history
… in TreeTransform.

Differential Revision: https://reviews.llvm.org/D85423
  • Loading branch information
hokein committed Aug 7, 2020
1 parent 1eade73 commit 6717476
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
6 changes: 3 additions & 3 deletions clang/lib/Sema/TreeTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -3618,8 +3618,8 @@ class TreeTransform {
}

ExprResult RebuildRecoveryExpr(SourceLocation BeginLoc, SourceLocation EndLoc,
ArrayRef<Expr *> SubExprs) {
return getSema().CreateRecoveryExpr(BeginLoc, EndLoc, SubExprs);
ArrayRef<Expr *> SubExprs, QualType Type) {
return getSema().CreateRecoveryExpr(BeginLoc, EndLoc, SubExprs, Type);
}

private:
Expand Down Expand Up @@ -10209,7 +10209,7 @@ ExprResult TreeTransform<Derived>::TransformRecoveryExpr(RecoveryExpr *E) {
if (!getDerived().AlwaysRebuild() && !Changed)
return E;
return getDerived().RebuildRecoveryExpr(E->getBeginLoc(), E->getEndLoc(),
Children);
Children, E->getType());
}

template<typename Derived>
Expand Down
14 changes: 14 additions & 0 deletions clang/test/SemaTemplate/recovery-tree-transform-crash.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// RUN: %clang_cc1 -verify -frecovery-ast -frecovery-ast-type %s

template <class T> struct Ptr { T *operator->() const; };

struct ABC {
void run();
};

Ptr<ABC> call(int); // expected-note {{candidate function not viable}}

void test() {
call()->run(undef); // expected-error {{no matching function for call to 'call'}} \
expected-error {{use of undeclared identifier}}
}

0 comments on commit 6717476

Please sign in to comment.