diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -3616,8 +3616,8 @@ } ExprResult RebuildRecoveryExpr(SourceLocation BeginLoc, SourceLocation EndLoc, - ArrayRef SubExprs) { - return getSema().CreateRecoveryExpr(BeginLoc, EndLoc, SubExprs); + ArrayRef SubExprs, QualType Type) { + return getSema().CreateRecoveryExpr(BeginLoc, EndLoc, SubExprs, Type); } private: @@ -10207,7 +10207,7 @@ if (!getDerived().AlwaysRebuild() && !Changed) return E; return getDerived().RebuildRecoveryExpr(E->getBeginLoc(), E->getEndLoc(), - Children); + Children, E->getType()); } template diff --git a/clang/test/SemaTemplate/recovery-tree-transform-crash.cpp b/clang/test/SemaTemplate/recovery-tree-transform-crash.cpp new file mode 100644 --- /dev/null +++ b/clang/test/SemaTemplate/recovery-tree-transform-crash.cpp @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -verify -frecovery-ast -frecovery-ast-type %s + +template struct Ptr { T *operator->() const; }; + +struct ABC { + void run(); +}; + +Ptr 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}} +}