C++ regression g++.pt/crash43.C

Nathan Sidwell nathan@acm.org
Wed May 26 07:33:00 GMT 1999


Hi,
I just built today's snapshot with --enable-checking. I get a failure of
g++.pt/crash43.C because of some cases error_mark_node slipping by and being
incorporated into type trees. Investigation went beyond my understanding of the
compiler. There are (at least) two problems

first on line 10
finish_member_class_template (semantics.c) gets a TYPES with a TREE_VALUE of
error_mark_node, grok_x_components doesn't notice this and then TYPE_CONTEXT
(TREE_VALUE (types)) barfs.

second on line 18
handle_class_head gets an ID which is a TREE_TYPE, but only because it's seen
the definition of S<T>. This causes structsp (parse.y) (class_head choice) to
barf when it's checking the TYPE_BINFO_BASETYPES ($$.t) (last branch on the
if).

I'm attaching the testcase FWIW,

nathan

-- 
Dr Nathan Sidwell :: Computer Science Department :: Bristol University
        I have seen the death of PhotoShop -- it is called GIMP
nathan@acm.org  http://www.cs.bris.ac.uk/~nathan/  nathan@cs.bris.ac.uk
// Build don't link:
// Origin: Mark Mitchell <mark@codesourcery.com>

template <int T>
struct S {
  struct X {};
  struct Y {};

  template <int U>
  friend struct S<U>::X; // ERROR - typename as friend

  template <int U>
  friend typename S<U>::Y; // ERROR - typename as friend
};

struct T {
  template <int T>
  friend struct S<T>::X; // ERROR - typename as friend
};

struct U {
  template <int T>
  friend typename S<T>::X; // ERROR - typename as friend
};


More information about the Gcc-bugs mailing list