Skip to content

Commit eb5d69c

Browse files
authored
[Clang] use begin member expr location for call expr with deducing this (llvm#117345)
Fixes llvm#116928
1 parent 5322415 commit eb5d69c

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,8 @@ Bug Fixes to AST Handling
732732
sometimes incorrectly return null even if a comment was present. (#GH108145)
733733
- Clang now correctly parses the argument of the ``relates``, ``related``, ``relatesalso``,
734734
and ``relatedalso`` comment commands.
735+
- Clang now uses the location of the begin of the member expression for ``CallExpr``
736+
involving deduced ``this``. (#GH116928)
735737

736738
Miscellaneous Bug Fixes
737739
^^^^^^^^^^^^^^^^^^^^^^^

clang/lib/Sema/SemaOverload.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15565,7 +15565,7 @@ ExprResult Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE,
1556515565
// Build the actual expression node.
1556615566
ExprResult FnExpr =
1556715567
CreateFunctionRefExpr(*this, Method, FoundDecl, MemExpr,
15568-
HadMultipleCandidates, MemExpr->getExprLoc());
15568+
HadMultipleCandidates, MemExpr->getBeginLoc());
1556915569
if (FnExpr.isInvalid())
1557015570
return ExprError();
1557115571

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -std=c++2b -ast-dump %s | FileCheck -strict-whitespace %s
2+
3+
namespace GH116928 {
4+
struct S {
5+
int f(this S&);
6+
};
7+
8+
int main() {
9+
S s;
10+
int x = s.f();
11+
// CHECK: CallExpr 0x{{[^ ]*}} <col:11, col:15> 'int
12+
// CHECK-NEXT: |-ImplicitCastExpr 0x{{[^ ]*}} <col:11> 'int (*)(S &)' <FunctionToPointerDecay>
13+
// CHECK-NEXT: | `-DeclRefExpr 0x{{[^ ]*}} <col:11> 'int (S &)' lvalue CXXMethod 0x{{[^ ]*}} 'f' 'int (S &)'
14+
}
15+
}

0 commit comments

Comments
 (0)