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++/7818] protected members still non-reachable from an unbound friend template member function


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From lerdsuwa at gcc dot gnu dot org  2003-08-10 14:37 -------
I think the testcase is invalid, and the correct one should be:
    
    template <class T> struct Y {
      void member() {
        X<int> c;
        c.prot_data = 2;
      }
    };
     
    template <class S> class X {
      int prot_data;
      template <class T> friend void Y<T>::member();
    };
   
    template class Y<int>;

Here Y<T>::member is declared before it is referenced
in the friend declaration.  This is according to 8.3p1
section of the standard:

  ... When the declarator-id is qualified, the declaration
  shall refer to a previously declared member of the class
  or namespace to which the qualifier refers, ...

I'm working on a fix for the valid case above.


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