c++/9222: compiler crash in nested, self-referential template

bangerth@dealii.org bangerth@dealii.org
Tue Jan 7 23:34:00 GMT 2003


Synopsis: compiler crash in nested, self-referential template

State-Changed-From-To: open->closed
State-Changed-By: bangerth
State-Changed-When: Tue Jan  7 15:34:01 2003
State-Changed-Why:
    This is already fixed in 3.2.2pre, 3.3pre and 3.4 mainline,
    but I can confirm the crash for 3.2. With the first three
    versions, you now get something along
    tmp/g> /home/bangerth/bin/gcc-3.2.2-pre/bin/c++ -c gccbug.cpp
    gccbug.cpp: In constructor `FinalIterator<T, Iterator,
       Impl>::iterator::iterator(const Impl&) [with T = int, Iterator =
       ForwardIterator, Impl = int]':
    gccbug.cpp:30:   instantiated from here
    gccbug.cpp:21: no type named `iterator' in `struct ForwardIterator'
    gccbug.cpp:21: no matching function for call to `ForwardIterator::iterator<int,
       FinalIterator<int, ForwardIterator, int>::iterator, int>::iterator()'
    gccbug.cpp:5: candidates are: ForwardIterator::iterator<int, FinalIterator<int,
       ForwardIterator, int>::iterator, int>::iterator(const
       ForwardIterator::iterator<int, FinalIterator<int, ForwardIterator,
       int>::iterator, int>&)
    gccbug.cpp:8:                 ForwardIterator::iterator<T, Final,
       Impl>::iterator(const Impl&) [with T = int, Final = FinalIterator<int,
       ForwardIterator, int>::iterator, Impl = int]
    
    As you mentioned, the bug goes away when you uncomment
    the one line: the original code is illegal, while the
    second line is the legal one, so you need to write that
    one (the class name is only an alias of the class name
    + all its template arguments for the present class, not
    for the base class). The error was thus an ICE-on-illegal,
    but as mentioned this is already fixed.
    
    Thanks
      W.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9222



More information about the Gcc-prs mailing list