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++/11860] New: internal compiler error: in lookup_template_class


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

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

           Summary: internal compiler error: in lookup_template_class
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: utke at mcs dot anl dot gov
                CC: gcc-bugs at gcc dot gnu dot org

while trying solve a different issue I came across this problem where the 
existence of a class derived from a template class causes the 
problem in the lookup. 
In the attached source things are ok when the definition of 
class A1 is commented out. So I guess the confusion is between 
the the two specialization of A, one in the definition of A1 and 
the other on the declaration of b;  

tmf.cpp: In instantiation of `B<A<int> >':
tmf.cpp:29:   instantiated from here
tmf.cpp:20: internal compiler error: in lookup_template_class, at cp/pt.c:4219
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

compiler version: 
Reading specs from
/m_home/m_utkej/gcc-3.3_inst/lib/gcc-lib/i686-pc-linux-gnu/3.3/specs
Configured with: ../gcc-3.3/configure --prefix=/m_home/m_utkej/gcc-3.3_inst
--enable-languages=c,c++,f77
Thread model: posix
gcc version 3.3


Source
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
template <class T> 
class A { 
public: 
  A(){};
  ~A(){};
protected: 
  template<class X> friend class B; 
  void foo(){};
};

// when the A1 class is commented out
// the compile doesn't fail
class A1: public A<int> { 
public: 
  A1(){};
  ~A1(){};
};

template <class T> 
class B { 
public: 
  B(){};
  ~B(){};
  T myT;
  void bar() { myT.foo();};
}; 

int main() { 
  B<A<int> > b; 
  // this works only as long as the 
  // the entire definition of A1 is commented out
  // what I really wanted to do is 
  // B<A1> b; 
  // which was trying to reproduce a situation 
  // where somehow it complains that foo is protected
  // even though B is declared a friend in A... 
  // but that is another issue :-( 
  b.bar();
}


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