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++/13935] New: [3.4/3.5 Regression] Template friend lookup bug


Posted by MattT originally within PR13813, but it's not related to that bug so 
I moved it to a different PR.

----------------------------------------------
template < class TP1 >
class MainClass {
public:
  
  class A;
  
  friend class B;
  
  A a;
  
  template < class TP2 > class B {};
  
  class A {
    
    template < class TP2 > friend class B;
    
  };
  
};

int main(int argc, char *argv[]) {
  MainClass<int> var;
}
----------------------------------------------
matt.cc: At global scope:
matt.cc: In instantiation of `MainClass<int>::A':
matt.cc:9:   instantiated from `MainClass<int>'
matt.cc:22:   instantiated from here
matt.cc:13: error: `template<class TP2> struct MainClass<int>::B' redeclared as 
different kind of symbol
matt.cc:13: error: previous declaration of `struct B'


EDG is confused because it refuses the definition of variable "a" at parsing 
time (which is wrong, since its type is dependent - MainClass<T>::A - even 
under DR224). 

It *looks* like the code should be accepted to me.

-- 
           Summary: [3.4/3.5 Regression] Template friend lookup bug
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: giovannibajo at libero dot it
                CC: gcc-bugs at gcc dot gnu dot org,mattyt-bugzilla at tpg
                    dot com dot au


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


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