[clang] [clang]get non-injected-class before finding instantiated decl (PR #70886)

Congcong Cai via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 1 06:27:33 PDT 2023


================
@@ -429,3 +429,19 @@ namespace qualified_friend_no_match {
     friend void Y::f(double); // expected-error {{friend declaration of 'f' does not match any declaration in 'qualified_friend_no_match::Y'}}
   };
 }
+
+namespace gh21483 {
+template <typename I>
+struct B {
+  struct mixin {
+    int type;
+    friend void foo(B<I>::mixin it) {
+      (void)it.mixin::type;
----------------
HerrCai0907 wrote:

`::` is scope resolution operator.
A more clear example is 
```c++
struct T {
    int a;
};
struct T1 : public T {
    int a;
};

void foo () {
    T1{}.T::a;
    T1{}.T1::a;
}
```
https://godbolt.org/z/K1b1jodse

https://github.com/llvm/llvm-project/pull/70886


More information about the cfe-commits mailing list