llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: None (llvmbot)

<details>
<summary>Changes</summary>

resolves llvm/llvm-project#<!-- -->80887

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


2 Files Affected:

- (modified) clang/include/clang/Sema/Lookup.h (+2-1) 
- (modified) clang/test/CXX/class.derived/class.member.lookup/p11.cpp (+22) 


``````````diff
diff --git a/clang/include/clang/Sema/Lookup.h 
b/clang/include/clang/Sema/Lookup.h
index 9c93bf1e6fb428..2f2f2607a937fe 100644
--- a/clang/include/clang/Sema/Lookup.h
+++ b/clang/include/clang/Sema/Lookup.h
@@ -754,7 +754,8 @@ class LookupResult {
 
 private:
   void diagnoseAccess() {
-    if (isClassLookup() && getSema().getLangOpts().AccessControl)
+    if (!isAmbiguous() && isClassLookup() &&
+        getSema().getLangOpts().AccessControl)
       getSema().CheckLookupAccess(*this);
   }
 
diff --git a/clang/test/CXX/class.derived/class.member.lookup/p11.cpp 
b/clang/test/CXX/class.derived/class.member.lookup/p11.cpp
index e0899b227e69bd..a42febaca3f041 100644
--- a/clang/test/CXX/class.derived/class.member.lookup/p11.cpp
+++ b/clang/test/CXX/class.derived/class.member.lookup/p11.cpp
@@ -23,3 +23,25 @@ struct D: I1, I2, B2 {
     int D::* mpD = &D::i; // expected-error {{non-static member 'i' found in 
multiple base-class subobjects of type 'B1'}}
   }
 };
+
+namespace GH80435 {
+struct A {
+  void *data; // expected-note {{member found by ambiguous name lookup}}
+};
+
+class B {
+  void *data; // expected-note {{member found by ambiguous name lookup}}
+};
+
+struct C : A, B {};
+
+decltype(C().data) x; // expected-error {{member 'data' found in multiple base 
classes of different types}}
+
+struct D { // expected-note {{candidate constructor (the implicit copy 
constructor) not viable: no known conversion from 'C' to 'const D' for 1st 
argument}}
+           // expected-note@-1{{candidate constructor (the implicit move 
constructor) not viable: no known conversion from 'C' to 'D' for 1st argument}}
+  template <typename Container, decltype(Container().data) = 0 >
+  D(Container); // expected-note {{candidate template ignored: substitution 
failure [with Container = C]: member 'data' found in multiple base classes of 
different types}}
+};
+
+D y(C{}); // expected-error {{no matching constructor for initialization of 
'D'}}
+}

``````````

</details>


https://github.com/llvm/llvm-project/pull/80903
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to