struct MyStruct {
	int a;
}

class MySimpleClass {
	public void method () {
		MySimpleClass ku = new MySimpleClass ();
		throw new GLib.OptionError.FAILED("test exception");

	}
	
}

class MyClass : GLib.Object
{

  public void hard_method () {
	try {
		MySimpleClass mustnotfree1 = new MySimpleClass ();
		MyClass mustnotefree2 = new MyClass ();

		try {
			MySimpleClass mustfree1 = new MySimpleClass();
			MyClass mustfree2 = new MyClass();

			throw new GLib.OptionError.FAILED("test exception");

		} catch (GLib.OptionError e) {
		}
	} catch (GLib.OptionError e) {
	}
  }

  public void method () {
	try {
		 MySimpleClass ku = new MySimpleClass ();
		 throw new GLib.OptionError.FAILED("test exception");
 	} catch (GLib.OptionError e) {
	}
  }

  ~MyClass()
  {
    stdout.printf("destroying MyObject\n");
  }
}

int main()
{
  try
  {
    MyStruct st = new MyStruct ();
    stdout.printf("hello, world\n");
    var s = new MyClass();
    s.method ();

    var u = new MySimpleClass();
    u.method ();
    MyClass b = new MyClass ();
    throw new GLib.OptionError.FAILED("test exception");
    MyClass c = new MyClass ();
  }
  catch(GLib.OptionError e)
  {
    stderr.printf("error: %s\n", e.message);
  }

  return 0;
}

