Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
c526348
[Clang] fix overload resolution for object parameters with top-level …
a-tarasyuk Sep 29, 2024
0c343f6
Merge branch 'main' into fix/100394
a-tarasyuk Sep 30, 2024
102b119
Merge branch 'main' into fix/100394
a-tarasyuk Oct 1, 2024
d377c01
adjust overload resolution for volatile qualifiers
a-tarasyuk Oct 6, 2024
f78e998
Merge branch 'fix/100394' of https://github.com/a-tarasyuk/llvm-proje…
a-tarasyuk Oct 6, 2024
191d7d4
Merge branch 'main' of https://github.com/llvm/llvm-project into fix/…
a-tarasyuk Oct 6, 2024
d524f7c
adjust qualifier restrictions for overriding explicit object members
a-tarasyuk Oct 8, 2024
9511a52
Merge branch 'main' of https://github.com/llvm/llvm-project into fix/…
a-tarasyuk Oct 9, 2024
aaf0ce0
Merge branch 'main' into fix/100394
a-tarasyuk Oct 9, 2024
2780baf
Merge branch 'main' into fix/100394
a-tarasyuk Oct 9, 2024
b5819ea
Merge branch 'main' into fix/100394
a-tarasyuk Oct 9, 2024
437d507
Merge branch 'main' into fix/100394
a-tarasyuk Oct 9, 2024
a9696bd
Merge branch 'main' into fix/100394
a-tarasyuk Oct 10, 2024
e16fb9d
Merge branch 'main' into fix/100394
a-tarasyuk Oct 10, 2024
db98a55
Merge branch 'main' into fix/100394
a-tarasyuk Oct 10, 2024
ca389fc
Merge branch 'main' into fix/100394
a-tarasyuk Oct 10, 2024
29f8470
Merge branch 'main' into fix/100394
a-tarasyuk Oct 10, 2024
31bbcd5
Merge branch 'main' into fix/100394
a-tarasyuk Oct 10, 2024
8c32076
Merge branch 'main' into fix/100394
a-tarasyuk Oct 11, 2024
cd6c974
Merge branch 'main' into fix/100394
a-tarasyuk Oct 11, 2024
7662b8d
Merge branch 'main' into fix/100394
a-tarasyuk Oct 11, 2024
8666062
use existing utility to resolve this type
a-tarasyuk Oct 11, 2024
d105690
Merge branch 'fix/100394' of https://github.com/a-tarasyuk/llvm-proje…
a-tarasyuk Oct 11, 2024
928c763
Merge branch 'main' of https://github.com/llvm/llvm-project into fix/…
a-tarasyuk Oct 11, 2024
045269b
Merge branch 'main' into fix/100394
a-tarasyuk Oct 11, 2024
e15c1f2
Merge branch 'main' into fix/100394
a-tarasyuk Oct 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,7 @@ Bug Fixes to C++ Support
containing outer unexpanded parameters were not correctly expanded. (#GH101754)
- Fixed a bug in constraint expression comparison where the ``sizeof...`` expression was not handled properly
in certain friend declarations. (#GH93099)
- Fixed overload handling for object parameters with top-level cv-qualifiers in explicit member functions (#GH100394)

Bug Fixes to AST Handling
^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
6 changes: 6 additions & 0 deletions clang/lib/Sema/SemaOverload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1511,6 +1511,12 @@ static bool IsOverloadOrOverrideImpl(Sema &SemaRef, FunctionDecl *New,
auto NewObjectType = New->getFunctionObjectParameterReferenceType();
auto OldObjectType = Old->getFunctionObjectParameterReferenceType();

if (Old->isExplicitObjectMemberFunction() &&
OldObjectType.getQualifiers() != NewObjectType.getQualifiers())
return OldObjectType.isConstQualified() &&
(NewObjectType.isConstQualified() ||
NewObjectType.isVolatileQualified());

auto IsImplicitWithNoRefQual = [](const CXXMethodDecl *F) {
return F->getRefQualifier() == RQ_None &&
!F->isExplicitObjectMemberFunction();
Expand Down
13 changes: 13 additions & 0 deletions clang/test/SemaCXX/cxx2b-deducing-this.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1073,3 +1073,16 @@ int main() {
return foo[]; // expected-error {{no viable overloaded operator[] for type 'Foo'}}
}
}

namespace GH100394 {
struct C1 {
void f(this const C1);
void f() const; // ok
};

struct C2 {
void f(this const C2); // expected-note {{previous declaration is here}}
void f(this volatile C2); // expected-error {{class member cannot be redeclared}} \
// expected-warning {{volatile-qualified parameter type 'volatile C2' is deprecated}}
};
}
Loading