Skip to content

Commit 366651f

Browse files
committed
[Clang][Sema] Fix out-of-bounds access
1 parent 390b997 commit 366651f

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

clang/lib/Sema/SemaOverload.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7719,8 +7719,8 @@ bool Sema::CheckNonDependentConversions(
77197719
unsigned Offset =
77207720
Method && Method->hasCXXExplicitFunctionObjectParameter() ? 1 : 0;
77217721

7722-
for (unsigned I = 0, N = std::min(ParamTypes.size(), Args.size()); I != N;
7723-
++I) {
7722+
for (unsigned I = 0, N = std::min(ParamTypes.size() - Offset, Args.size());
7723+
I != N; ++I) {
77247724
QualType ParamType = ParamTypes[I + Offset];
77257725
if (!ParamType->isDependentType()) {
77267726
unsigned ConvIdx;

clang/test/SemaCXX/cxx2b-deducing-this.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,3 +636,13 @@ struct D {
636636
}
637637
};
638638
}
639+
640+
namespace GH80971 {
641+
struct S {
642+
auto f(this auto self...) { }
643+
};
644+
645+
int bug() {
646+
S{}.f(0);
647+
}
648+
}

0 commit comments

Comments
 (0)