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]

c++/495: g++ crashes in lookup_template_class (2.95.2 and 20000829)



>Number:         495
>Category:       c++
>Synopsis:       g++ crashes in lookup_template_class (2.95.2 and 20000829)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Wed Aug 30 03:06:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Wolfgang Bangerth
>Release:        gcc 2.95.2 and 20000829 snapshot
>Organization:
>Environment:
Sun Solaris 7
>Description:
G++ crashes (or reports a bogus error) in a strange combination
of templates, friends, and instantiations. Maybe it is that
I need to declare class `Y' before declaring it a friend to
class `X', but anyway gcc should not crash (or might give
a better error message for the line outcommented).

This is the program:
template <int N>
struct X           {  template <int dim> friend struct Y; };
X<2> x;

template <int dim>
struct Y           {  void f (Y);  };

template <int dim>
void Y<dim>::f (Y) {};
//void Y<dim>::f (Y<dim>) {};

The error messages from the 20000829 snapshot are as follows:
>  /tmp/@30636.1:9: Internal compiler error in lookup_template_class, at 
      ../gcc/cp/pt.c:3849
      Please submit a full bug report.
      See for instructions.

...or, if the one line is uncommented and the one before
commented (not very helpful):
>   /tmp/@30722.1:10: no `void Y::f (Y)' member function declared in class `Y'
>   /tmp/@30722.1:10: template definition of non-template `void Y::f (Y)'
>   /tmp/@30722.1: In member function `void Y::f (Y)':
>   /tmp/@30722.1:6: `struct Y' is inaccessible
>   /tmp/@30722.1:10: within this context

gcc 2.95.2 produces slightly different but similar error
messages, including the crash.

Regards
  Wolfgang
>How-To-Repeat:
Just compile
>Fix:
Don't know
>Release-Note:
>Audit-Trail:
>Unformatted:

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