Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[clang]: fix overload resolution in case of bind rvalue ref to const lvalue ref #133035

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

changkhothuychung
Copy link
Contributor

@changkhothuychung changkhothuychung commented Mar 26, 2025

fix #132600

@changkhothuychung changkhothuychung marked this pull request as draft March 26, 2025 04:57
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Mar 26, 2025
@llvmbot
Copy link
Member

llvmbot commented Mar 26, 2025

@llvm/pr-subscribers-clang

Author: Nhat Nguyen (changkhothuychung)

Changes

fix #132600


Full diff: https://github.com/llvm/llvm-project/pull/133035.diff

1 Files Affected:

  • (modified) clang/lib/Sema/SemaOverload.cpp (+1-1)
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 6d8006b35dcf4..28843f378c686 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -5419,7 +5419,7 @@ TryReferenceInit(Sema &S, Expr *Init, QualType DeclType,
   //   the argument expression. Any difference in top-level
   //   cv-qualification is subsumed by the initialization itself
   //   and does not constitute a conversion.
-  ICS = TryImplicitConversion(S, Init, T1, SuppressUserConversions,
+  ICS = TryImplicitConversion(S, Init, DeclType, SuppressUserConversions,
                               AllowedExplicit::None,
                               /*InOverloadResolution=*/false,
                               /*CStyle=*/false,

Copy link

github-actions bot commented Mar 26, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@changkhothuychung
Copy link
Contributor Author

the failing test in clang/test/SemaCXX/copy-assignment.cpp seems like to be another clang bug - https://godbolt.org/z/79bWMscx9

@changkhothuychung changkhothuychung marked this pull request as ready for review March 26, 2025 06:28
@changkhothuychung changkhothuychung changed the title [clang]: fix overload resolution in case of converting const value reference to an rvalue reference. [clang]: fix overload resolution in case of bind rvalue ref to const lvalue ref Mar 27, 2025
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 Clang issues not falling into any other category
Projects
None yet
2 participants