[clang] [clang]not lookup name containing a dependent type (PR #77587)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 10 03:29:18 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Congcong Cai (HerrCai0907)
<details>
<summary>Changes</summary>
Fixes: #<!-- -->77583
bcd51aaaf8bde4b0ae7a4155d9ce3dec78fe2598 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
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
``````````
</details>
https://github.com/llvm/llvm-project/pull/77587
More information about the cfe-commits
mailing list