This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/32204] friend from global namespace in template class ignored


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32204

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to work|                            |4.6.3, 4.7.0, 4.8.0
         Resolution|                            |FIXED
   Target Milestone|---                         |4.6.0
      Known to fail|                            |4.5.1

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-03-26 23:51:26 UTC ---
G++ 4.6.0 and later correctly compile this

namespace A { template < class PIX > class B; }

void f(A::B<int>&);

template < class PIX > class A::B {
  friend void ::f(A::B<int>&);
  PIX z;
};

void f(A::B<int>& i) { int a = i.z; }

int main() {
  A::B<int> b;
  f(b);         // 1. error: f is ambiguous (no, there is no 2nd declaration!)
  ::f(b);       // 2. error: z is private (yes, but 'f' is a friend)
// A::f(b);      // 3. error: f is not a member of A (of course)
}

So I think this bug is fixed


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]