c++/8591: g++ crashes while instantiating templates

bangerth@dealii.org bangerth@dealii.org
Fri Nov 15 08:52:00 GMT 2002


Synopsis: g++ crashes while instantiating templates

State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Fri Nov 15 08:52:05 2002
State-Changed-Why:
    Confirmed. A reduced testcase is
    -------------------------------------
    namespace NS {
      template <class T1, class T2, class T3 = int, class T4 = int>
      struct C {};
    }
    
    template <class T> class X {
        friend class NS::C;
    };
    
    X<int> c;
    ----------------------------------
    I get a segfault:
    tmp/g> /home/bangerth/bin/gcc-3.3x-pre/bin/g++ -c x.cc
    x.cc: In instantiation of `X<int>':
    x.cc:10:   instantiated from here
    x.cc:6: internal compiler error: Speicherzugriffsfehler
    Please submit a full bug report,
    with preprocessed source if appropriate.
    See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
    
    This is for all versions of gcc, including present CVS.
    
    My list of similar reports (friends and templates and/or 
    namespaces) includes PRs 8355, 8280, 8099, 53, 641, 765, 
    1016, 6256. The last one may be the closest.
    
    By the way, the code is illegal, since you have to declare
    the friend as
      template <...> friend class NS::C;
    Fixing this makes the ICE go away.

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



More information about the Gcc-bugs mailing list