Segfault in type resolver

Imported from http://bugzilla.roxen.com/bugzilla/show_bug.cgi?id=5086

Reported by Martin Stjernholm mast@roxen.com

The following minimized program dumps core:

  class X
  {
    X bar();
  }

  class Y
  {
    constant X = global::X;
    X foo();
  }

Note that both foo and bar declarations have to exist with the type X in them to trig the bug.

In 7.6 there's instead a compilation error "Constant values may not have references to this" on the constant definition line.