================ @@ -568,6 +568,80 @@ namespace cwg137 { // cwg137: yes const volatile int *cvqcv = static_cast<const volatile int*>(cvp); } +namespace cwg138 { // cwg138: partial +namespace example1 { +void foo(); // #cwg138-ex1-foo +namespace A { + using example1::foo; // #cwg138-ex1-using + class X { + static const int i = 10; + // This friend declaration is using neither qualified-id nor template-id, + // so name 'foo' is not looked up, which means the using-declaration has no effect. + // Target scope of this declaration is A, so this is grating friendship to + // (hypothetical) A::foo instead of 'example1::foo' using declaration refers to. + // A::foo corresponds to example1::foo named by the using declaration, + // and since A::foo is a different entity, they potentially conflict. + // FIXME: This is ill-formed, but not for the reason diagnostic says. + friend void foo(); + // expected-error@-1 {{cannot befriend target of using declaration}} + // expected-note@#cwg138-ex1-foo {{target of using declaration}} + // expected-note@#cwg138-ex1-using {{using declaration}} ---------------- cor3ntin wrote:
Do you want to try to fix this one? https://github.com/llvm/llvm-project/pull/106117 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits