diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index b9986434d09d2..b43218de0e8b8 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -726,6 +726,8 @@ Bug Fixes to AST Handling sometimes incorrectly return null even if a comment was present. (#GH108145) - Clang now correctly parses the argument of the ``relates``, ``related``, ``relatesalso``, and ``relatedalso`` comment commands. +- Clang now uses the location of the begin of the member expression for ``CallExpr`` + involving deduced ``this``. (#GH116928) Miscellaneous Bug Fixes ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index e4bf9aa521224..4c9e37bd286de 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -15565,7 +15565,7 @@ ExprResult Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE, // Build the actual expression node. ExprResult FnExpr = CreateFunctionRefExpr(*this, Method, FoundDecl, MemExpr, - HadMultipleCandidates, MemExpr->getExprLoc()); + HadMultipleCandidates, MemExpr->getBeginLoc()); if (FnExpr.isInvalid()) return ExprError(); diff --git a/clang/test/AST/ast-dump-cxx2b-deducing-this.cpp b/clang/test/AST/ast-dump-cxx2b-deducing-this.cpp new file mode 100644 index 0000000000000..04cff07376885 --- /dev/null +++ b/clang/test/AST/ast-dump-cxx2b-deducing-this.cpp @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -std=c++2b -ast-dump %s | FileCheck -strict-whitespace %s + +namespace GH116928 { +struct S { + int f(this S&); +}; + +int main() { + S s; + int x = s.f(); + // CHECK: CallExpr 0x{{[^ ]*}} 'int + // CHECK-NEXT: |-ImplicitCastExpr 0x{{[^ ]*}} 'int (*)(S &)' + // CHECK-NEXT: | `-DeclRefExpr 0x{{[^ ]*}} 'int (S &)' lvalue CXXMethod 0x{{[^ ]*}} 'f' 'int (S &)' +} +}