Skip to content

[clang]not lookup name containing a dependent type #77587

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

Conversation

HerrCai0907
Copy link
Contributor

Fixes: #77583
bcd51aa fixed part of template instantiation dependent name issues but still missing some cases This patch want to enhance the dependent name check

Fixes: #77583
bcd51aa fixed part of template instantiation dependent name issues but still missing some cases
This patch want to enhance the dependent name check
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Jan 10, 2024
@llvmbot
Copy link
Member

llvmbot commented Jan 10, 2024

@llvm/pr-subscribers-clang

Author: Congcong Cai (HerrCai0907)

Changes

Fixes: #77583
bcd51aa fixed part of template instantiation dependent name issues but still missing some cases This patch want to enhance the dependent name check


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

2 Files Affected:

  • (modified) clang/lib/Sema/SemaExprMember.cpp (+2-1)
  • (modified) clang/test/SemaCXX/conversion-function.cpp (+11-3)
diff --git a/clang/lib/Sema/SemaExprMember.cpp b/clang/lib/Sema/SemaExprMember.cpp
index 2abec3d86a27d9..32998ae60eafe2 100644
--- a/clang/lib/Sema/SemaExprMember.cpp
+++ b/clang/lib/Sema/SemaExprMember.cpp
@@ -782,7 +782,8 @@ Sema::BuildMemberReferenceExpr(Expr *Base, QualType BaseType,
                                const Scope *S,
                                ActOnMemberAccessExtraArgs *ExtraArgs) {
   if (BaseType->isDependentType() ||
-      (SS.isSet() && isDependentScopeSpecifier(SS)))
+      (SS.isSet() && isDependentScopeSpecifier(SS)) ||
+      NameInfo.getName().isDependentName())
     return ActOnDependentMemberExpr(Base, BaseType,
                                     IsArrow, OpLoc,
                                     SS, TemplateKWLoc, FirstQualifierInScope,
diff --git a/clang/test/SemaCXX/conversion-function.cpp b/clang/test/SemaCXX/conversion-function.cpp
index b6e6142d179066..220ae78f2d8246 100644
--- a/clang/test/SemaCXX/conversion-function.cpp
+++ b/clang/test/SemaCXX/conversion-function.cpp
@@ -475,13 +475,21 @@ struct S {
 
 #if __cplusplus >= 201103L
 namespace dependent_conversion_function_id_lookup {
-  template<typename T> struct A {
+  struct A1 {
+    operator int();
+  };
+  template<class T> struct C {
+    template <typename U> using Lookup = decltype(T{}.operator U());
+  };
+  C<A1> v{};
+
+  template<typename T> struct A2 {
     operator T();
   };
-  template<typename T> struct B : A<T> {
+  template<typename T> struct B : A2<T> {
     template<typename U> using Lookup = decltype(&B::operator U);
   };
   using Result = B<int>::Lookup<int>;
-  using Result = int (A<int>::*)();
+  using Result = int (A2<int>::*)();
 }
 #endif

Copy link
Collaborator

@erichkeane erichkeane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a release note, else LGTM.

@@ -475,13 +475,21 @@ struct S {

#if __cplusplus >= 201103L
namespace dependent_conversion_function_id_lookup {
template<typename T> struct A {
struct A1 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a comment with the number of the relevant github issue(s) ? thanks

@HerrCai0907 HerrCai0907 merged commit bd2a6ef into main Jan 11, 2024
@HerrCai0907 HerrCai0907 deleted the users/ccc/77583-conversion-function-depended-on-template-cannot-be-rebuild-during-instantiating-class branch January 11, 2024 10:43
justinfargnoli pushed a commit to justinfargnoli/llvm-project that referenced this pull request Jan 28, 2024
Fixes: llvm#77583
bcd51aa fixed part of template
instantiation dependent name issues but still missing some cases This
patch want to enhance the dependent name check
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
Development

Successfully merging this pull request may close these issues.

conversion function depended on template cannot be rebuild during instantiating class
4 participants