Skip to content

[C++20] [Modules] Load friends for classes in ADL - #219094

Merged
ChuanqiXu9 merged 1 commit into
llvm:mainfrom
ChuanqiXu9:ModulesLoadFriends
Aug 27, 2026
Merged

ChuanqiXu9 merged 1 commit into
llvm:mainfrom
ChuanqiXu9:ModulesLoadFriends

Conversation

@ChuanqiXu9

Copy link
Copy Markdown
Member

Close #218228

The root cause of the problem is the corresponding friend is not loaded at the point of ADL.

This patch tries to fix this simply by loading the friends at the point of ADL. Note that this may be best efficient if there are a lot of friends. We just think it is rare. If it is really possible, we can change the structure of friends from a list to a name lookup table.

Close llvm#218228

The root cause of the problem is the corresponding friend
is not loaded at the point of ADL.

This patch tries to fix this simply by loading the friends
at the point of ADL. Note that this may be best efficient
if there are a lot of friends. We just think it is rare.
If it is really possible, we can change the structure of friends
from a list to a name lookup table.
@ChuanqiXu9 ChuanqiXu9 self-assigned this Aug 27, 2026
@ChuanqiXu9 ChuanqiXu9 added clang:modules C++20 modules and Clang Header Modules skip-precommit-approval PR for CI feedback, not intended for review labels Aug 27, 2026
@ChuanqiXu9
ChuanqiXu9 enabled auto-merge (squash) August 27, 2026 02:51
@llvmorg-github-actions llvmorg-github-actions Bot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Aug 27, 2026
@ChuanqiXu9
ChuanqiXu9 merged commit 01aedf3 into llvm:main Aug 27, 2026
15 of 17 checks passed
wlemkows pushed a commit to wlemkows/llvm-project that referenced this pull request Sep 4, 2026
Close llvm#218228

The root cause of the problem is the corresponding friend is not loaded
at the point of ADL.

This patch tries to fix this simply by loading the friends at the point
of ADL. Note that this may be best efficient if there are a lot of
friends. We just think it is rare. If it is really possible, we can
change the structure of friends from a list to a name lookup table.
asudarsa-qti pushed a commit to asudarsa-qti/llvm-project that referenced this pull request Sep 4, 2026
Close llvm#218228

The root cause of the problem is the corresponding friend is not loaded
at the point of ADL.

This patch tries to fix this simply by loading the friends at the point
of ADL. Note that this may be best efficient if there are a lot of
friends. We just think it is rare. If it is really possible, we can
change the structure of friends from a list to a name lookup table.
@avikivity

Copy link
Copy Markdown
Contributor

Please backport to clang 23

@ChuanqiXu9

Copy link
Copy Markdown
Member Author

/cherry-pick 01aedf3

@llvmbot

llvmbot commented Sep 10, 2026

Copy link
Copy Markdown
Member

Failed to cherry-pick: 01aedf3

https://github.com/llvm/llvm-project/actions/runs/34429071152

Please manually backport the fix and push it to your github fork. Once this is done, please create a pull request

@avikivity

Copy link
Copy Markdown
Contributor

@ChuanqiXu9 looks like the cherry-pick bot needs your help

@ChuanqiXu9

Copy link
Copy Markdown
Member Author

@ChuanqiXu9 looks like the cherry-pick bot needs your help

Yeah, it seems like there is a merge conflicts. I am busy this week. And if you're hurry, I feel it may be fine for you to cherry-pick it manually in 23.x and backport it.

@avikivity

Copy link
Copy Markdown
Contributor

#226711

avikivity pushed a commit to avikivity/llvm-project that referenced this pull request Sep 26, 2026
Close llvm#218228

The root cause of the problem is the corresponding friend is not loaded
at the point of ADL.

This patch tries to fix this simply by loading the friends at the point
of ADL. Note that this may be best efficient if there are a lot of
friends. We just think it is rare. If it is really possible, we can
change the structure of friends from a list to a name lookup table.

(cherry picked from commit 01aedf3)
tru pushed a commit that referenced this pull request Sep 29, 2026
Close #218228

The root cause of the problem is the corresponding friend is not loaded
at the point of ADL.

This patch tries to fix this simply by loading the friends at the point
of ADL. Note that this may be best efficient if there are a lot of
friends. We just think it is rare. If it is really possible, we can
change the structure of friends from a list to a name lookup table.

(cherry picked from commit 01aedf3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:frontend Language frontend issues, e.g. anything involving "Sema" clang:modules C++20 modules and Clang Header Modules clang Clang issues not falling into any other category release:cherry-pick-failed skip-precommit-approval PR for CI feedback, not intended for review

Projects

Development

Successfully merging this pull request may close these issues.

[C++20] [Modules] ADL fails to find operator| of range adaptor if the same closure was used in imported module

3 participants