# Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */

# Please email any bugs, comments, and/or additions to this file to:
# bug-gdb@prep.ai.mit.edu

# This file was written by Fred Fish. (fnf@cygnus.com)

if $tracelevel then {
	strace $tracelevel
}

#
# Single inheritance, print individual members.
#

proc test_print_si_members {} {
    global prompt

    # Print all members of g_A using fully qualified form.

    send "print g_A.A::a\n"
    expect {
	-re ".* = 1\r\n$prompt $" { pass "print g_A.A::a" }
	-re ".*$prompt $" { fail "print g_A.A::a" }
	timeout { fail "print g_A.A::a (timeout)" ; return }
    }

    send "print g_A.A::x\n"
    expect {
	-re ".* = 2\r\n$prompt $" { pass "print g_A.A::x" }
	-re ".*$prompt $" { fail "print g_A.A::x" }
	timeout { fail "print g_A.A::x (timeout)" ; return }
    }

    # Print members of g_A using nonambiguous compact form.

    send "print g_A.a\n"
    expect {
	-re ".* = 1\r\n$prompt $" { pass "print g_A.a" }
	-re ".*$prompt $" { fail "print g_A.a" }
	timeout { fail "print g_A.a (timeout)" ; return }
    }

    send "print g_A.x\n"
    expect {
	-re ".* = 2\r\n$prompt $" { pass "print g_A.x" }
	-re ".*$prompt $" { fail "print g_A.x" }
	timeout { fail "print g_A.x (timeout)" ; return }
    }

    # Print all members of g_B using fully qualified form.

    send "print g_B.A::a\n"
    expect {
	-re ".* = 3\r\n$prompt $" { pass "print g_B.A::a" }
	-re ".*$prompt $" { fail "print g_B.A::a" }
	timeout { fail "print g_B.A::a (timeout)" ; return }
    }

    send "print g_B.A::x\n"
    expect {
	-re ".* = 4\r\n$prompt $" { pass "print g_B.A::x" }
	-re ".*$prompt $" { fail "print g_B.A::x" }
	timeout { fail "print g_B.A::x (timeout)" ; return }
    }

    send "print g_B.B::b\n"
    expect {
	-re ".* = 5\r\n$prompt $" { pass "print g_B.B::b" }
	-re ".*$prompt $" { fail "print g_B.B::b" }
	timeout { fail "print g_B.B::b (timeout)" ; return }
    }

    send "print g_B.B::x\n"
    expect {
	-re ".* = 6\r\n$prompt $" { pass "print g_B.B::x" }
	-re ".*$prompt $" { fail "print g_B.B::x" }
	timeout { fail "print g_B.B::x (timeout)" ; return }
    }

    # Print members of g_B using nonambiguous compact form.

    send "print g_B.a\n"
    expect {
	-re ".* = 3\r\n$prompt $" { pass "print g_B.a" }
	-re ".*$prompt $" { fail "print g_B.a" }
	timeout { fail "print g_B.a (timeout)" ; return }
    }

    send "print g_B.b\n"
    expect {
	-re ".* = 5\r\n$prompt $" { pass "print g_B.b" }
	-re ".*$prompt $" { fail "print g_B.b" }
	timeout { fail "print g_B.b (timeout)" ; return }
    }

    send "print g_B.x\n"
    expect {
	-re ".* = 6\r\n$prompt $" { pass "print g_B.x" }
	-re ".*$prompt $" { fail "print g_B.x" }
	timeout { fail "print g_B.x (timeout)" ; return }
    }

    # Print all members of g_C using fully qualified form.

    send "print g_C.A::a\n"
    expect {
	-re ".* = 7\r\n$prompt $" { pass "print g_C.A::a" }
	-re ".*$prompt $" { fail "print g_C.A::a" }
	timeout { fail "print g_C.A::a (timeout)" ; return }
    }

    send "print g_C.A::x\n"
    expect {
	-re ".* = 8\r\n$prompt $" { pass "print g_C.A::x" }
	-re ".*$prompt $" { fail "print g_C.A::x" }
	timeout { fail "print g_C.A::x (timeout)" ; return }
    }

    send "print g_C.C::c\n"
    expect {
	-re ".* = 9\r\n$prompt $" { pass "print g_C.C::c" }
	-re ".*$prompt $" { fail "print g_C.C::c" }
	timeout { fail "print g_C.C::c (timeout)" ; return }
    }

    send "print g_C.C::x\n"
    expect {
	-re ".* = 10\r\n$prompt $" { pass "print g_C.C::x" }
	-re ".*$prompt $" { fail "print g_C.C::x" }
	timeout { fail "print g_C.C::x (timeout)" ; return }
    }

    # Print members of g_C using nonambiguous compact form.

    send "print g_C.a\n"
    expect {
	-re ".* = 7\r\n$prompt $" { pass "print g_C.a" }
	-re ".*$prompt $" { fail "print g_C.a" }
	timeout { fail "print g_C.a (timeout)" ; return }
    }

    send "print g_C.c\n"
    expect {
	-re ".* = 9\r\n$prompt $" { pass "print g_C.c" }
	-re ".*$prompt $" { fail "print g_C.c" }
	timeout { fail "print g_C.c (timeout)" ; return }
    }

    send "print g_C.x\n"
    expect {
	-re ".* = 10\r\n$prompt $" { pass "print g_C.x" }
	-re ".*$prompt $" { fail "print g_C.x" }
	timeout { fail "print g_C.x (timeout)" ; return }
    }
}

#
# Single inheritance, print type definitions.
#

proc test_ptype_si {} {
    global prompt

    # Print class A as a type.

    send "ptype A\n"
    expect {
	-re "type = class A \{\r\n.*\[ \]*int a;\r\n\[ \]*int x;\r\n.*\[ \]*\}\r\n$prompt $" {
	    pass "ptype A (FIXME)"
	}
	-re "type = struct A \{\r\n\[ \]*int a;\r\n\[ \]*int x;\r\n\[ \]*\}\r\n$prompt $" {
	    setup_xfail "*-*-*"
	    fail "ptype A (FIXME)"
	}
	-re ".*$prompt $" { fail "ptype A" }
	timeout { fail "ptype A (timeout)" ; return }
    }

    # Print class A as an explicit class.

    send "ptype class A\n"
    expect {
	-re "type = class A \{\r\n.*\[ \]*int a;\r\n\[ \]*int x;\r\n.*\[ \]*\}\r\n$prompt $" {
	    pass "ptype class A (FIXME)"
	}
	-re "type = struct A \{\r\n\[ \]*int a;\r\n\[ \]*int x;\r\n\[ \]*\}\r\n$prompt $" {
	    setup_xfail "*-*-*"
	    fail "ptype class A (FIXME)"
	}
	-re ".*$prompt $" { fail "ptype class A" }
	timeout { fail "ptype class A (timeout)" ; return }
    }

    # Print type of an object of type A.

    send "ptype g_A\n"
    expect {
	-re "type = class A \{\r\n.*\[ \]*int a;\r\n\[ \]*int x;\r\n.*\[ \]*\}\r\n$prompt $" {
	    pass "ptype g_A (FIXME)"
	}
	-re "type = struct A \{\r\n\[ \]*int a;\r\n\[ \]*int x;\r\n\[ \]*\}\r\n$prompt $" {
	    setup_xfail "*-*-*"
	    fail "ptype g_A (FIXME)"
	}
	-re ".*$prompt $" { fail "ptype g_A" }
	timeout { fail "ptype g_A (timeout)" ; return }
    }

    # Print class B as a type.

    send "ptype B\n"
    expect {
	-re "type = class B : public A \{\r\n\[ \]*public:\r\n\[ \]*int b;\r\n\[ \]*int x;\r\n.*\}\r\n$prompt $" {
	    pass "ptype B"
	}
	-re ".*$prompt $" { fail "ptype B" }
	timeout { fail "ptype B (timeout)" ; return }
    }

    # Print class B as an explicit class.

    send "ptype class B\n"
    expect {
	-re "type = class B : public A \{\r\n\[ \]*public:\r\n\[ \]*int b;\r\n\[ \]*int x;\r\n.*\}\r\n$prompt $" {
	    pass "ptype class B"
	}
	-re ".*$prompt $" { fail "ptype class B" }
	timeout { fail "ptype class B (timeout)" ; return }
    }

    # Print type of an object of type B.

    send "ptype g_B\n"
    expect {
	-re "type = class B : public A \{\r\n\[ \]*public:\r\n\[ \]*int b;\r\n\[ \]*int x;\r\n.*\}\r\n$prompt $" {
	    pass "ptype g_B"
	}
	-re ".*$prompt $" { fail "ptype g_B" }
	timeout { fail "ptype g_B (timeout)" ; return }
    }

    # Print class C as a type.

    send "ptype C\n"
    expect {
	-re "type = class C : public A \{\r\n\[ \]*public:\r\n\[ \]*int c;\r\n\[ \]*int x;\r\n.*\}\r\n$prompt $" {
	    pass "ptype C"
	}
	-re ".*$prompt $" { fail "ptype C" }
	timeout { fail "ptype C (timeout)" ; return }
    }

    # Print class C as an explicit class.

    send "ptype class C\n"
    expect {
	-re "type = class C : public A \{\r\n\[ \]*public:\r\n\[ \]*int c;\r\n\[ \]*int x;\r\n.*\}\r\n$prompt $" {
	    pass "ptype class C"
	}
	-re ".*$prompt $" { fail "ptype class C" }
	timeout { fail "ptype class C (timeout)" ; return }
    }

    # Print type of an object of type g_C.

    send "ptype g_C\n"
    expect {
	-re "type = class C : public A \{\r\n\[ \]*public:\r\n\[ \]*int c;\r\n\[ \]*int x;\r\n.*\}\r\n$prompt $" {
	    pass "ptype g_C"
	}
	-re ".*$prompt $" { fail "ptype g_C" }
	timeout { fail "ptype g_C (timeout)" ; return }
    }

    # gcc cygnus-2.3.3 (Q1) has this bug, but it was fixed as of
    # cygnus-2.3.3-930417.  PR 2819.
    gdb_test "ptype tagless_struct" "type = (struct|class).*\{.*int one;.*int two;.*\}" \
	"print tagless struct (known bug in gcc 2.4.5-2.5.8)"
    gdb_test "ptype v_tagless" "type = (struct|class).*\{.*int one;.*int two;.*\}" \
	"ptype variable of type tagless struct (known bug in gcc 2.4.5-2.5.8)"
}

#
# Single inheritance, print complete classes.
#

proc test_print_si_classes {} {
    global prompt

    # Print all members of g_A.

    send "print g_A\n"
    expect {
	-re ".* = \{a = 1, x = 2\}\r\n$prompt $" {
	    pass "print g_A"
	}
	-re ".*$prompt $" { fail "print g_A" }
	timeout { fail "print g_A (timeout)" ; return }
    }

    # Print all members of g_B.

    send "print g_B\n"
    expect {
	-re ".* = \{\<A\> = \{a = 3, x = 4\}, b = 5, x = 6\}\r\n$prompt $" {
	    pass "print g_B"
	}
	-re ".*$prompt $" { fail "print g_B" }
	timeout { fail "print g_B (timeout)" ; return }
    }

    # Print all members of g_C.

    send "print g_C\n"
    expect {
	-re ".* = \{\<A\> = \{a = 7, x = 8\}, c = 9, x = 10\}\r\n$prompt $" {
	    pass "print g_C"
	}
	-re ".*$prompt $" { fail "print g_C" }
	timeout { fail "print g_C (timeout)" ; return }
    }
}

#
# Single inheritance, print anonymous unions.
# GDB versions prior to 4.14 entered an infinite loop when printing
# the type of a class containing an anonymous union, and they were also
# incapable of printing the member of an anonymous union.
# We test the printing of the member first, and perform the other tests
# only if the test succeeds, to avoid the infinite loop.
#

proc test_print_anon_union {} {
    global prompt

    send "print g_anon_union.a\n"
    expect {
	-re ".* = 2\r\n$prompt $" { pass "print anonymous union member" }
	-re ".*$prompt $" { fail "print anonymous union member" ; return }
	default { fail "print anonymous union member (timeout)" ; return }
    }
    gdb_test "print g_anon_union" \
	     ".* = .*{one = 1,  = {a = 2, b = .*}}" \
	     "print anonymous union (known bug in gcc 2.4.5-2.5.8)"
    gdb_test "ptype g_anon_union" \
	     "type = (struct|class).*{.*int one;.*union {.*int a;.*(long|long int|int) b;.*};.*}" \
	     "print type of anonymous union (known bug in gcc 2.4.5-2.5.8)"
}

#
# Multiple inheritance, print individual members.
#

proc test_print_mi_members {} {
    global prompt

    # Print all members of g_A.

    send "print g_A.A::a\n"
    expect {
	-re ".* = 1\r\n$prompt $" { pass "print g_A.A::a" }
	-re ".*$prompt $" { fail "print g_A.A::a" }
	timeout { fail "print g_A.A::a (timeout)" ; return }
    }
    
    send "print g_A.A::x\n"
    expect {
	-re ".* = 2\r\n$prompt $" { pass "print g_A.A::x" }
	-re ".*$prompt $" { fail "print g_A.A::x" }
	timeout { fail "print g_A.A::x (timeout)" ; return }
    }

    # Print all members of g_B.

    send "print g_B.A::a\n"
    expect {
	-re ".* = 3\r\n$prompt $" { pass "print g_B.A::a" }
	-re ".*$prompt $" { fail "print g_B.A::a" }
	timeout { fail "print g_B.A::a (timeout)" ; return }
    }

    send "print g_B.A::x\n"
    expect {
	-re ".* = 4\r\n$prompt $" { pass "print g_B.A::x" }
	-re ".*$prompt $" { fail "print g_B.A::x" }
	timeout { fail "print g_B.A::x (timeout)" ; return }
    }

    send "print g_B.B::b\n"
    expect {
	-re ".* = 5\r\n$prompt $" { pass "print g_B.B::b" }
	-re ".*$prompt $" { fail "print g_B.B::b" }
	timeout { fail "print g_B.B::b (timeout)" ; return }
    }

    send "print g_B.B::x\n"
    expect {
	-re ".* = 6\r\n$prompt $" { pass "print g_B.B::x" }
	-re ".*$prompt $" { fail "print g_B.B::x" }
	timeout { fail "print g_B.B::x (timeout)" ; return }
    }

    # Print all members of g_C.

    send "print g_C.A::a\n"
    expect {
	-re ".* = 7\r\n$prompt $" { pass "print g_C.A::a" }
	-re ".*$prompt $" { fail "print g_C.A::a" }
	timeout { fail "print g_C.A::a (timeout)" ; return }
    }

    send "print g_C.A::x\n"
    expect {
	-re ".* = 8\r\n$prompt $" { pass "print g_C.A::x" }
	-re ".*$prompt $" { fail "print g_C.A::x" }
	timeout { fail "print g_C.A::x (timeout)" ; return }
    }

    send "print g_C.C::c\n"
    expect {
	-re ".* = 9\r\n$prompt $" { pass "print g_C.C::c" }
	-re ".*$prompt $" { fail "print g_C.C::c" }
	timeout { fail "print g_C.C::c (timeout)" ; return }
    }

    send "print g_C.C::x\n"
    expect {
	-re ".* = 10\r\n$prompt $" { pass "print g_C.C::x" }
	-re ".*$prompt $" { fail "print g_C.C::x" }
	timeout { fail "print g_C.C::x (timeout)" ; return }
    }

    # Print all members of g_D.

    # The following is ambiguous, and gdb should detect this.
    # For now, accept gdb's behavior as an expected failure if it
    # simply prints either member correctly.

    setup_xfail "*-*-*"
    send "print g_D.A::a\n"
    expect {
	-re ".* = 11\r\n$prompt $" {
	    fail "print g_D.A::a (FIXME)"
	}
	-re ".* = 15\r\n$prompt $" {
	    fail "print g_D.A::a (FIXME)"
	}
	-re ".*$prompt $" { fail "print g_D.A::a" }
	timeout { fail "print g_D.A::a (timeout)" ; return }
    }

    # The following is ambiguous, and gdb should detect this.
    # For now, accept gdb's behavior as an expected failure if it
    # simply prints either member correctly.

    setup_xfail "*-*-*"
    send "print g_D.A::x\n"
    expect {
	-re ".* = 12\r\n$prompt $" {
	    fail "print g_D.A::x (FIXME)"
	}
	-re ".* = 16\r\n$prompt $" {
	    fail "print g_D.A::x (FIXME)"
	}
	-re ".*$prompt $" { fail "print g_D.A::x" }
	timeout { fail "print g_D.A::x (timeout)" ; return }
    }

    send "print g_D.B::b\n"
    expect {
	-re ".* = 13\r\n$prompt $" { pass "print g_D.B::b" }
	-re ".*$prompt $" { fail "print g_D.B::b" }
	timeout { fail "print g_D.B::b (timeout)" ; return }
    }

    send "print g_D.B::x\n"
    expect {
	-re ".* = 14\r\n$prompt $" { pass "print g_D.B::x" }
	-re ".*$prompt $" { fail "print g_D.B::x" }
	timeout { fail "print g_D.B::x (timeout)" ; return }
    }

    send "print g_D.C::c\n"
    expect {
	-re ".* = 17\r\n$prompt $" { pass "print g_D.C::c" }
	-re ".*$prompt $" { fail "print g_D.C::c" }
	timeout { fail "print g_D.C::c (timeout)" ; return }
    }

    send "print g_D.C::x\n"
    expect {
	-re ".* = 18\r\n$prompt $" { pass "print g_D.C::x" }
	-re ".*$prompt $" { fail "print g_D.C::x" }
	timeout { fail "print g_D.C::x (timeout)" ; return }
    }

    send "print g_D.D::d\n"
    expect {
	-re ".* = 19\r\n$prompt $" { pass "print g_D.D::d" }
	-re ".*$prompt $" { fail "print g_D.D::d" }
	timeout { fail "print g_D.D::d (timeout)" ; return }
    }

    send "print g_D.D::x\n"
    expect {
	-re ".* = 20\r\n$prompt $" { pass "print g_D.D::x" }
	-re ".*$prompt $" { fail "print g_D.D::x" }
	timeout { fail "print g_D.D::x (timeout)" ; return }
    }

    # Print all members of g_E.

    # The following is ambiguous, and gdb should detect this.
    # For now, accept gdb's behavior as an expected failure if it
    # simply prints either member correctly.

    setup_xfail "*-*-*"
    send "print g_E.A::a\n"
    expect {
	-re ".* = 21\r\n$prompt $" {
	    fail "print g_E.A::a (FIXME)"
	}
	-re ".* = 25\r\n$prompt $" {
	    fail "print g_E.A::a (FIXME)"
	}
	-re ".*$prompt $" { fail "print g_E.A::a" }
	timeout { fail "print g_E.A::a (timeout)" ; return }
    }

    # The following is ambiguous, and gdb should detect this.
    # For now, accept gdb's behavior as an expected failure if it
    # simply prints either member correctly.

    setup_xfail "*-*-*"
    send "print g_E.A::x\n"
    expect {
	-re ".* = 22\r\n$prompt $" {
	    fail "print g_E.A::x (FIXME)"
	}
	-re ".* = 26\r\n$prompt $" {
	    fail "print g_E.A::x (FIXME)"
	}
	-re ".*$prompt $" { fail "print g_E.A::x" }
	timeout { fail "print g_E.A::x (timeout)" ; return }
    }

    send "print g_E.B::b\n"
    expect {
	-re ".* = 23\r\n$prompt $" { pass "print g_E.B::b" }
	-re ".*$prompt $" { fail "print g_E.B::b" }
	timeout { fail "print g_E.B::b (timeout)" ; return }
    }

    send "print g_E.B::x\n"
    expect {
	-re ".* = 24\r\n$prompt $" { pass "print g_E.B::x" }
	-re ".*$prompt $" { fail "print g_E.B::x" }
	timeout { fail "print g_E.B::x (timeout)" ; return }
    }

    send "print g_E.C::c\n"
    expect {
	-re ".* = 27\r\n$prompt $" { pass "print g_E.C::c" }
	-re ".*$prompt $" { fail "print g_E.C::c" }
	timeout { fail "print g_E.C::c (timeout)" ; return }
    }

    send "print g_E.C::x\n"
    expect {
	-re ".* = 28\r\n$prompt $" { pass "print g_E.C::x" }
	-re ".*$prompt $" { fail "print g_E.C::x" }
	timeout { fail "print g_E.C::x (timeout)" ; return }
    }

    send "print g_E.D::d\n"
    expect {
	-re ".* = 29\r\n$prompt $" { pass "print g_E.D::d" }
	-re ".*$prompt $" { fail "print g_E.D::d" }
	timeout { fail "print g_E.D::d (timeout)" ; return }
    }

    send "print g_E.D::x\n"
    expect {
	-re ".* = 30\r\n$prompt $" { pass "print g_E.D::x" }
	-re ".*$prompt $" { fail "print g_E.D::x" }
	timeout { fail "print g_E.D::x (timeout)" ; return }
    }

    send "print g_E.E::e\n"
    expect {
	-re ".* = 31\r\n$prompt $" { pass "print g_E.E::e" }
	-re ".*$prompt $" { fail "print g_E.E::e" }
	timeout { fail "print g_E.E::e (timeout)" ; return }
    }

    send "print g_E.E::x\n"
    expect {
	-re ".* = 32\r\n$prompt $" { pass "print g_E.E::x" }
	-re ".*$prompt $" { fail "print g_E.E::x" }
	timeout { fail "print g_E.E::x (timeout)" ; return }
    }
}

#
# Multiple inheritance, print type definitions.
#

proc test_ptype_mi {} {
    global prompt

    send "ptype D\n"
    expect {
	-re "type = class D : public B, public C \{\r\n\[ \]*public:\r\n\[ \]*int d;\r\n\[ \]*int x;\r\n.*\}\r\n$prompt $" {
	    pass "ptype D"
	}
	-re ".*$prompt $" { fail "ptype D" }
	timeout { fail "ptype D (timeout)" ; return }
    }

    send "ptype class D\n"
    expect {
	-re "type = class D : public B, public C \{\r\n\[ \]*public:\r\n\[ \]*int d;\r\n\[ \]*int x;\r\n.*\}\r\n$prompt $" {
	    pass "ptype class D"
	}
	-re ".*$prompt $" { fail "ptype class D" }
	timeout { fail "ptype class D (timeout)" ; return }
    }

    send "ptype g_D\n"
    expect {
	-re "type = class D : public B, public C \{\r\n\[ \]*public:\r\n\[ \]*int d;\r\n\[ \]*int x;\r\n.*\}\r\n$prompt $" {
	    pass "ptype g_D"
	}
	-re ".*$prompt $" { fail "ptype g_D" }
	timeout { fail "ptype g_D (timeout)" ; return }
    }

    send "ptype E\n"
    expect {
	-re "type = class E : public D \{\r\n\[ \]*public:\r\n\[ \]*int e;\r\n\[ \]*int x;\r\n.*\}\r\n$prompt $" {
	    pass "ptype E"
	}
	-re ".*$prompt $" { fail "ptype E" }
	timeout { fail "ptype E (timeout)" ; return }
    }

    send "ptype class E\n"
    expect {
	-re "type = class E : public D \{\r\n\[ \]*public:\r\n\[ \]*int e;\r\n\[ \]*int x;\r\n.*\}\r\n$prompt $" {
	    pass "ptype class E"
	}
	-re ".*$prompt $" { fail "ptype class E" }
	timeout { fail "ptype class E (timeout)" ; return }
    }

    send "ptype g_E\n"
    expect {
	-re "type = class E : public D \{\r\n\[ \]*public:\r\n\[ \]*int e;\r\n\[ \]*int x;\r\n.*\}\r\n$prompt $" {
	    pass "ptype g_E"
	}
	-re ".*$prompt $" { fail "ptype g_E" }
	timeout { fail "ptype g_E (timeout)" ; return }
    }
}

#
# Multiple inheritance, print complete classes.
#

proc test_print_mi_classes {} {
    global prompt

    # Print all members of g_D.

    send "print g_D\n"
    expect {
	-re ".* = \{\<B\> = \{\<A\> = \{a = 11, x = 12\}, b = 13, x = 14\}, \<C\> = \{\<A\> = \{a = 15, x = 16\}, c = 17, x = 18\}, d = 19, x = 20\}\r\n$prompt $" {
	    pass "print g_D"
	}
	-re ".*$prompt $" { fail "print g_D" }
	timeout { fail "print g_D (timeout)" ; return }
    }

    # Print all members of g_E.

    send "print g_E\n"
    expect {
	-re ".* = \{\<D\> = \{\<B\> = \{\<A\> = \{a = 21, x = 22\}, b = 23, x = 24\}, \<C\> = \{\<A\> = \{a = 25, x = 26\}, c = 27, x = 28\}, d = 29, x = 30\}, e = 31, x = 32\}\r\n$prompt $" {
	    pass "print g_E"
	}
	-re ".*$prompt $" { fail "print g_E" }
	timeout { fail "print g_E (timeout)" ; return }
    }
}

#
# Single virtual inheritance, print individual members.
#

proc test_print_svi_members {} {
    global prompt
    global decimal

    # Print all members of g_vA.

    send "print g_vA.vA::va\n"
    expect {
	-re ".* = 1\r\n$prompt $" { pass "print g_vA.vA::va" }
	-re ".*$prompt $" { fail "print g_vA.vA::va" }
	timeout { fail "print g_vA.vA::va (timeout)" ; return }
    }

    send "print g_vA.vA::vx\n"
    expect {
	-re ".* = 2\r\n$prompt $" { pass "print g_vA.vA::vx" }
	-re ".*$prompt $" { fail "print g_vA.vA::vx" }
	timeout { fail "print g_vA.vA::vx (timeout)" ; return }
    }

    # Print members of g_vA using compact form.

    send "print g_vA.va\n"
    expect {
	-re ".* = 1\r\n$prompt $" { pass "print g_vA.va" }
	-re ".*$prompt $" { fail "print g_vA.va" }
	timeout { fail "print g_vA.va (timeout)" ; return }
    }

    send "print g_vA.vx\n"
    expect {
	-re ".* = 2\r\n$prompt $" { pass "print g_vA.vx" }
	-re ".*$prompt $" { fail "print g_vA.vx" }
	timeout { fail "print g_vA.vx (timeout)" ; return }
    }

    # Print all members of g_vB.

    send "print g_vB.vA::va\n"
    expect {
	-re ".* = 3\r\n$prompt $" { pass "print g_vB.vA::va" }
	-re ".*virtual baseclass botch.*$prompt $" {
	    # Does not happen with gcc cygnus-2.4.5-930828
	    fail "print g_vB.vA::va (known bug with gcc cygnus-2.4.5-930417)"
	    # Many of the rest of these tests have the same problem.
	    return 0
	}
	-re ".*$prompt $" { fail "print g_vB.vA::va" }
	timeout { fail "print g_vB.vA::va (timeout)" ; return }
    }

    send "print g_vB.vA::vx\n"
    expect {
	-re ".* = 4\r\n$prompt $" { pass "print g_vB.vA::vx" }
	-re ".*$prompt $" { fail "print g_vB.vA::vx" }
	timeout { fail "print g_vB.vA::vx (timeout)" ; return }
    }

    send "print g_vB.vB::vb\n"
    expect {
	-re ".* = 5\r\n$prompt $" { pass "print g_vB.vB::vb" }
	-re ".*$prompt $" { fail "print g_vB.vB::vb" }
	timeout { fail "print g_vB.vB::vb (timeout)" ; return }
    }

    send "print g_vB.vB::vx\n"
    expect {
	-re ".* = 6\r\n$prompt $" { pass "print g_vB.vB::vx" }
	-re ".*$prompt $" { fail "print g_vB.vB::vx" }
	timeout { fail "print g_vB.vB::vx (timeout)" ; return }
    }

    # Print members of g_vB using compact form.

    send "print g_vB.va\n"
    expect {
	-re ".* = 3\r\n$prompt $" { pass "print g_vB.va" }
	-re ".*$prompt $" { fail "print g_vB.va" }
	timeout { fail "print g_vB.va (timeout)" ; return }
    }

    send "print g_vB.vb\n"
    expect {
	-re ".* = 5\r\n$prompt $" { pass "print g_vB.vb" }
	-re ".*$prompt $" { fail "print g_vB.vb" }
	timeout { fail "print g_vB.vb (timeout)" ; return }
    }

    send "print g_vB.vx\n"
    expect {
	-re ".* = 6\r\n$prompt $" { pass "print g_vB.vx" }
	-re ".*$prompt $" { fail "print g_vB.vx" }
	timeout { fail "print g_vB.vx (timeout)" ; return }
    }

    # Print all members of g_vC.

    send "print g_vC.vA::va\n"
    expect {
	-re ".* = 7\r\n$prompt $" { pass "print g_vC.vA::va" }
	-re ".*$prompt $" { fail "print g_vC.vA::va" }
	timeout { fail "print g_vC.vA::va (timeout)" ; return }
    }

    send "print g_vC.vA::vx\n"
    expect {
	-re ".* = 8\r\n$prompt $" { pass "print g_vC.vA::vx" }
	-re ".*$prompt $" { fail "print g_vC.vA::vx" }
	timeout { fail "print g_vC.vA::vx (timeout)" ; return }
    }

    send "print g_vC.vC::vc\n"
    expect {
	-re ".* = 9\r\n$prompt $" { pass "print g_vC.vC::vc" }
	-re ".*$prompt $" { fail "print g_vC.vC::vc" }
	timeout { fail "print g_vC.vC::vc (timeout)" ; return }
    }

    send "print g_vC.vC::vx\n"
    expect {
	-re ".* = 10\r\n$prompt $" { pass "print g_vC.vC::vx" }
	-re ".*$prompt $" { fail "print g_vC.vC::vx" }
	timeout { fail "print g_vC.vC::vx (timeout)" ; return }
    }

    # Print members of g_vC using compact form.

    send "print g_vC.va\n"
    expect {
	-re ".* = 7\r\n$prompt $" { pass "print g_vC.va" }
	-re ".*$prompt $" { fail "print g_vC.va" }
	timeout { fail "print g_vC.va (timeout)" ; return }
    }

    send "print g_vC.vc\n"
    expect {
	-re ".* = 9\r\n$prompt $" { pass "print g_vC.vc" }
	-re ".*$prompt $" { fail "print g_vC.vc" }
	timeout { fail "print g_vC.vc (timeout)" ; return }
    }

    send "print g_vC.vx\n"
    expect {
	-re ".* = 10\r\n$prompt $" { pass "print g_vC.vx" }
	-re ".*$prompt $" { fail "print g_vC.vx" }
	timeout { fail "print g_vC.vx (timeout)" ; return }
    }
}

#
# Single virtual inheritance, print type definitions.
#

proc test_ptype_vi {} {
    global prompt

    # This class does not use any C++-specific features, so it's fine for
    # it to print as "struct".
    send "ptype vA\n"
    expect {
	-re "type = class vA \{\r\n\[ \]*public:\r\n\[ \]*int va;\r\n\[ \]*int vx;\r\n.*\}\r\n$prompt $" {
	    pass "ptype vA"
	}
	-re "type = struct vA \{\r\n\[ \]*int va;\r\n\[ \]*int vx;\r\n\}\r\n$prompt $" {
	    pass "ptype vA"
	}
	-re ".*$prompt $" { fail "ptype vA" }
	timeout { fail "ptype vA (timeout)" ; return }
    }

    # This class does not use any C++-specific features, so it's fine for
    # it to print as "struct".
    send "ptype class vA\n"
    expect {
	-re "type = class vA \{\r\n\[ \]*public:\r\n\[ \]*int va;\r\n\[ \]*int vx;\r\n.*\}\r\n$prompt $" {
	    pass "ptype class vA"
	}
	-re "type = struct vA \{\r\n\[ \]*int va;\r\n\[ \]*int vx;\r\n\}\r\n$prompt $" {
	    pass "ptype class vA"
	}
	-re ".*$prompt $" { fail "ptype class vA" }
	timeout { fail "ptype class vA (timeout)" ; return }
    }

    # This class does not use any C++-specific features, so it's fine for
    # it to print as "struct".
    send "ptype g_vA\n"
    expect {
	-re "type = class vA \{\r\n\[ \]*public:\r\n\[ \]*int va;\r\n\[ \]*int vx;\r\n.*\}\r\n$prompt $" {
	    pass "ptype g_vA"
	}
	-re "type = struct vA \{\r\n\[ \]*int va;\r\n\[ \]*int vx;\r\n\}\r\n$prompt $" {
	    pass "ptype g_vA"
	}
	-re ".*$prompt $" { fail "ptype g_vA" }
	timeout { fail "ptype g_vA (timeout)" ; return }
    }

    send "ptype vB\n"
    expect {
	-re "ptype vB\[\r\n\]+type = class vB : public virtual vA \{\r\n  private:\r\n\[ \]+vA \[*\]+_vb\[\\\$\.\]+vA;\r\n  public:\r\n\[ \]+int vb;\r\n\[ \]+int vx;\r\n.*\}\r\n$prompt $" {
	    pass "ptype vB"
	}
	-re ".*$prompt $" { fail "ptype vB" }
	timeout { fail "ptype vB (timeout)" ; return }
    }

    send "ptype class vB\n"
    expect {
	-re "type = class vB : public virtual vA \{\r\n\[ \]*private:\r\n\[ \]*vA \[*\]+_vb\[\\\$\.\]vA;\r\n\[ \]*public:\r\n\[ \]*int vb;\r\n\[ \]*int vx;\r\n.*\}\r\n$prompt $" {
	    pass "ptype class vB"
	}
	-re ".*$prompt $" { fail "ptype class vB" }
	timeout { fail "ptype class vB (timeout)" ; return }
    }

    send "ptype g_vB\n"
    expect {
	-re "type = class vB : public virtual vA \{\r\n\[ \]*private:\r\n\[ \]*vA \[*\]+_vb\[\\\$\.\]vA;\r\n\[ \]*public:\r\n\[ \]*int vb;\r\n\[ \]*int vx;\r\n.*\}\r\n$prompt $" {
	    pass "ptype g_vB"
	}
	-re ".*$prompt $" { fail "ptype g_vB" }
	timeout { fail "ptype g_vB (timeout)" ; return }
    }

    send "ptype vC\n"
    expect {
	-re "type = class vC : public virtual vA \{\r\n\[ \]*private:\r\n\[ \]*vA \[*\]+_vb\[\\\$\.\]vA;\r\n\[ \]*public:\r\n\[ \]*int vc;\r\n\[ \]*int vx;\r\n.*\}\r\n$prompt $" {
	}
	-re ".*$prompt $" { fail "ptype vC" }
	timeout { fail "ptype vC (timeout)" ; return }
    }

    send "ptype class vC\n"
    expect {
	-re "type = class vC : public virtual vA \{\r\n\[ \]*private:\r\n\[ \]*vA \[*\]+_vb\[\\\$\.\]vA;\r\n\[ \]*public:\r\n\[ \]*int vc;\r\n\[ \]*int vx;\r\n.*\}\r\n$prompt $" {
	}
	-re ".*$prompt $" { fail "ptype class vC" }
	timeout { fail "ptype class vC (timeout)" ; return }
    }

    send "ptype g_vC\n"
    expect {
	-re "type = class vC : public virtual vA \{\r\n\[ \]*private:\r\n\[ \]*vA \[*\]+_vb\[\\\$\.\]vA;\r\n\[ \]*public:\r\n\[ \]*int vc;\r\n\[ \]*int vx;\r\n.*\}\r\n$prompt $" {
	}
	-re ".*$prompt $" { fail "ptype g_vC" }
	timeout { fail "ptype g_vC (timeout)" ; return }
    }
}

#
# Single virtual inheritance, print complete classes.
#

proc test_print_svi_classes {} {
    global prompt
    global hex
    global decimal

    # Print all members of g_vA.

    send "print g_vA\n"
    expect {
	-re ".* = \{va = 1, vx = 2\}\r\n$prompt $" {
	    pass "print g_vA"
	}
	-re ".*$prompt $" { fail "print g_vA" }
	timeout { fail "print g_vA (timeout)" ; return }
    }

    # Print all members of g_vB.

    send "print g_vB\n"
    expect {
	-re ".* = \{\<vA\> = \{va = 3, vx = 4\}, _vb\[\\\$\.\]vA = $hex, vb = 5, vx = 6\}\r\n$prompt $" {
	    pass "print g_vB"
	}
	-re ".*invalid address 0x0.*$prompt $" {
	    # Does not happen with gcc cygnus-2.4.5-930828
	    fail "print g_vB (known bug with gcc cygnus-2.4.5-930417)"
	    # Many of the rest of these tests have the same problem.
	    return 0
	}
	-re ".*$prompt $" { fail "print g_vB" }
	timeout { fail "print g_vB (timeout)" ; return }
    }

    # Print all members of g_vC.

    send "print g_vC\n"
    expect {
	-re ".* = \{\<vA\> = \{va = 7, vx = 8\}, _vb\[\\\$\.\]vA = $hex, vc = 9, vx = 10\}\r\n$prompt $" {
	    pass "print g_vC"
	}
	-re ".*$prompt $" { fail "print g_vC" }
	timeout { fail "print g_vC (timeout)" ; return }
    }
}

#
# Multiple virtual inheritance, print individual members.
#

proc test_print_mvi_members {} {
    global prompt
    global decimal

    # Print all members of g_vD.

    send "print g_vD.vA::va\n"
    expect {
	-re ".* = 19\r\n$prompt $" { pass "print g_vD.vA::va" }
	-re ".*virtual baseclass botch.*$prompt $" {
	    # Does not happen with gcc cygnus-2.4.5-930828
	    fail "print g_vD.vA::va (known bug with gcc cygnus-2.4.5-930417)"
	    # Many of the rest of these tests have the same problem.
	    return 0
	}
	-re ".*$prompt $" { fail "print g_vD.vA::va" }
	timeout { fail "print g_vD.vA::va (timeout)" ; return }
    }

    send "print g_vD.vA::vx\n"
    expect {
	-re ".* = 20\r\n$prompt $" { pass "print g_vD.vA::vx" }
	-re ".*$prompt $" { fail "print g_vD.vA::vx" }
	timeout { fail "print g_vD.vA::vx (timeout)" ; return }
    }

    send "print g_vD.vB::vb\n"
    expect {
	-re ".* = 21\r\n$prompt $" { pass "print g_vD.vB::vb" }
	-re ".*$prompt $" { fail "print g_vD.vB::vb" }
	timeout { fail "print g_vD.vB::vb (timeout)" ; return }
    }

    send "print g_vD.vB::vx\n"
    expect {
	-re ".* = 22\r\n$prompt $" { pass "print g_vD.vB::vx" }
	-re ".*$prompt $" { fail "print g_vD.vB::vx" }
	timeout { fail "print g_vD.vB::vx (timeout)" ; return }
    }

    send "print g_vD.vC::vc\n"
    expect {
	-re ".* = 23\r\n$prompt $" { pass "print g_vD.vC::vc" }
	-re ".*$prompt $" { fail "print g_vD.vC::vc" }
	timeout { fail "print g_vD.vC::vc (timeout)" ; return }
    }

    send "print g_vD.vC::vx\n"
    expect {
	-re ".* = 24\r\n$prompt $" { pass "print g_vD.vC::vx" }
	-re ".*$prompt $" { fail "print g_vD.vC::vx" }
	timeout { fail "print g_vD.vC::vx (timeout)" ; return }
    }

    send "print g_vD.vD::vd\n"
    expect {
	-re ".* = 25\r\n$prompt $" { pass "print g_vD.vD::vd" }
	-re ".*$prompt $" { fail "print g_vD.vD::vd" }
	timeout { fail "print g_vD.vD::vd (timeout)" ; return }
    }

    send "print g_vD.vD::vx\n"
    expect {
	-re ".* = 26\r\n$prompt $" { pass "print g_vD.vD::vx" }
	-re ".*$prompt $" { fail "print g_vD.vD::vx" }
	timeout { fail "print g_vD.vD::vx (timeout)" ; return }
    }

    # Print all members of g_vE.

    send "print g_vE.vA::va\n"
    expect {
	-re ".* = 0\r\n$prompt $" { pass "print g_vE.vA::va" }
	-re ".*$prompt $" { fail "print g_vE.vA::va" }
	timeout { fail "print g_vE.vA::va (timeout)" ; return }
    }

    send "print g_vE.vA::vx\n"
    expect {
	-re ".* = 0\r\n$prompt $" { pass "print g_vE.vA::vx" }
	-re ".*$prompt $" { fail "print g_vE.vA::vx" }
	timeout { fail "print g_vE.vA::vx (timeout)" ; return }
    }

    send "print g_vE.vB::vb\n"
    expect {
	-re ".* = 0\r\n$prompt $" { pass "print g_vE.vB::vb" }
	-re ".*$prompt $" { fail "print g_vE.vB::vb" }
	timeout { fail "print g_vE.vB::vb (timeout)" ; return }
    }

    send "print g_vE.vB::vx\n"
    expect {
	-re ".* = 0\r\n$prompt $" { pass "print g_vE.vB::vx" }
	-re ".*$prompt $" { fail "print g_vE.vB::vx" }
	timeout { fail "print g_vE.vB::vx (timeout)" ; return }
    }

    send "print g_vE.vC::vc\n"
    expect {
	-re ".* = 0\r\n$prompt $" { pass "print g_vE.vC::vc" }
	-re ".*$prompt $" { fail "print g_vE.vC::vc" }
	timeout { fail "print g_vE.vC::vc (timeout)" ; return }
    }

    send "print g_vE.vC::vx\n"
    expect {
	-re ".* = 0\r\n$prompt $" { pass "print g_vE.vC::vx" }
	-re ".*$prompt $" { fail "print g_vE.vC::vx" }
	timeout { fail "print g_vE.vC::vx (timeout)" ; return }
    }

    send "print g_vE.vD::vd\n"
    expect {
	-re ".* = 0\r\n$prompt $" { pass "print g_vE.vD::vd" }
	-re ".*$prompt $" { fail "print g_vE.vD::vd" }
	timeout { fail "print g_vE.vD::vd (timeout)" ; return }
    }

    send "print g_vE.vD::vx\n"
    expect {
	-re ".* = 0\r\n$prompt $" { pass "print g_vE.vD::vx" }
	-re ".*$prompt $" { fail "print g_vE.vD::vx" }
	timeout { fail "print g_vE.vD::vx (timeout)" ; return }
    }

    send "print g_vE.vE::ve\n"
    expect {
	-re ".* = 27\r\n$prompt $" { pass "print g_vE.vE::ve" }
	-re ".*$prompt $" { fail "print g_vE.vE::ve" }
	timeout { fail "print g_vE.vE::ve (timeout)" ; return }
    }

    send "print g_vE.vE::vx\n"
    expect {
	-re ".* = 28\r\n$prompt $" { pass "print g_vE.vE::vx" }
	-re ".*$prompt $" { fail "print g_vE.vE::vx" }
	timeout { fail "print g_vE.vE::vx (timeout)" ; return }
    }
}

#
# Multiple virtual inheritance, print type definitions.
#

proc test_ptype_mvi {} {
    global prompt

    send "ptype vD\n"
    expect {
	-re "type = class vD : public virtual vB, public virtual vC \{\r\n\[ \]*private:\r\n\[ \]*vC \[*\]+_vb\[\\\$\.\]vC;\r\n\[ \]*vB \[*\]+_vb\[\\\$\.\]vB;\r\n\[ \]*public:\r\n\[ \]*int vd;\r\n\[ \]*int vx;\r\n.*\}\r\n$prompt $" {
	    pass "ptype vD"
	}
	-re ".*$prompt $" { fail "ptype vD" }
	timeout { fail "ptype vD (timeout)" ; return }
    }

    send "ptype class vD\n"
    expect {
	-re "type = class vD : public virtual vB, public virtual vC \{\r\n\[ \]*private:\r\n\[ \]*vC \[*\]+_vb\[\\\$\.\]vC;\r\n\[ \]*vB \[*\]+_vb\[\\\$\.\]vB;\r\n\[ \]*public:\r\n\[ \]*int vd;\r\n\[ \]*int vx;\r\n.*\}\r\n$prompt $" {
	    pass "ptype class vD"
	}
	-re ".*$prompt $" { fail "ptype class vD" }
	timeout { fail "ptype class vD (timeout)" ; return }
    }

    send "ptype g_vD\n"
    expect {
	-re "type = class vD : public virtual vB, public virtual vC \{\r\n\[ \]*private:\r\n\[ \]*vC \[*\]+_vb\[\\\$\.\]vC;\r\n\[ \]*vB \[*\]+_vb\[\\\$\.\]vB;\r\n\[ \]*public:\r\n\[ \]*int vd;\r\n\[ \]*int vx;\r\n.*\}\r\n$prompt $" {
	    pass "ptype g_vD"
	}
	-re ".*$prompt $" { fail "ptype g_vD" }
	timeout { fail "ptype g_vD (timeout)" ; return }
    }

    send "ptype vE\n"
    expect {
	-re "type = class vE : public virtual vD \{\r\n\[ \]*private:\r\n\[ \]*vD \[*\]+_vb\[\\\$\.\]vD;\r\n\[ \]*public:\r\n\[ \]*int ve;\r\n\[ \]*int vx;\r\n.*\}\r\n$prompt $" {
	    pass "ptype vE"
	}
	-re ".*$prompt $" { fail "ptype vE" }
	timeout { fail "ptype vE (timeout)" ; return }
    }

    send "ptype class vE\n"
    expect {
	-re "type = class vE : public virtual vD \{\r\n\[ \]*private:\r\n\[ \]*vD \[*\]+_vb\[\\\$\.\]vD;\r\n\[ \]*public:\r\n\[ \]*int ve;\r\n\[ \]*int vx;\r\n.*\}\r\n$prompt $" {
	    pass "ptype class vE"
	}
	-re ".*$prompt $" { fail "ptype class vE" }
	timeout { fail "ptype class vE (timeout)" ; return }
    }

    send "ptype g_vE\n"
    expect {
	-re "type = class vE : public virtual vD \{\r\n\[ \]*private:\r\n\[ \]*vD \[*\]+_vb\[\\\$\.\]vD;\r\n\[ \]*public:\r\n\[ \]*int ve;\r\n\[ \]*int vx;\r\n.*\}\r\n$prompt $" {
	    pass "ptype g_vE"
	}
	-re ".*$prompt $" { fail "ptype g_vE" }
	timeout { fail "ptype g_vE (timeout)" ; return }
    }
}

#
# Multiple virtual inheritance, print complete classes.
#

proc test_print_mvi_classes {} {
    global prompt
    global hex
    global decimal

    # Print all members of g_vD.

    send "print g_vD\n"
    expect {
	-re ".* = \{\<vB\> = \{\<vA\> = \{va = 19, vx = 20\}, _vb\[\\\$\.\]vA = $hex, vb = 21, vx = 22\}, \<vC\> = \{_vb\[\\\$\.\]vA = $hex, vc = 23, vx = 24\}, _vb\[\\\$\.\]vC = $hex, _vb\[\\\$\.\]vB = $hex, vd = 25, vx = 26\}\r\n$prompt $" {
	    pass "print g_vD"
	}
	-re ".*invalid address 0x0.*$prompt $" {
	    # Does not happen with gcc cygnus-2.4.5-930828
	    fail "print g_vD (known bug with gcc cygnus-2.4.5-930417)"
	    # Many of the rest of these tests have the same problem.
	    return 0
	}
	-re ".*$prompt $" { fail "print g_vD" }
	timeout { fail "print g_vD (timeout)" ; return }
    }

    # Print all members of g_vE.

    send "print g_vE\n"
    expect {
	-re ".* = \{\<vD\> = \{\<vB\> = \{\<vA\> = \{va = 0, vx = 0\}, _vb\[\\\$\.\]vA = $hex, vb = 0, vx = 0\}, \<vC\> = \{_vb\[\\\$\.\]vA = $hex, vc = 0, vx = 0\}, _vb\[\\\$\.\]vC = $hex, _vb\[\\\$\.\]vB = $hex, vd = 0, vx = 0\}, _vb\[\\\$\.\]vD = $hex, ve = 27, vx = 28\}\r\n$prompt $" {
	    pass "print g_vE"
	}
	-re ".*$prompt $" { fail "print g_vE" }
	timeout { fail "print g_vE (timeout)" ; return }
    }
}

proc do_tests {} {
    global prms_id
    global bug_id
    global subdir
    global objdir
    global srcdir
    global binfile
    global prompt

    set prms_id 0
    set bug_id 0

    # Start with a fresh gdb.

    gdb_exit
    gdb_start
    gdb_reinitialize_dir $srcdir/$subdir
    gdb_load $objdir/$subdir/$binfile

    send "set language c++\n"
    expect -re "$prompt $"
    send "set width 0\n"
    expect -re "$prompt $"

    if [ runto_main ] then {
	test_ptype_si
	test_ptype_mi
	test_ptype_vi
	test_ptype_mvi
    }

    if [ runto 'inheritance2(void)' ] then {
	test_print_si_members
	test_print_si_classes
	test_print_mi_members
	test_print_mi_classes
	test_print_anon_union
    }

    if [ runto 'inheritance4(void)' ] then {
	test_print_svi_members
	test_print_svi_classes
	test_print_mvi_members
	test_print_mvi_classes
    }

}

# Check to see if we have an executable to test.  If not, then either we
# haven't tried to compile one, or the compilation failed for some reason.
# In either case, just notify the user and skip the tests in this file.

set binfile "misc"
set srcfile $binfile.cc

if ![file exists $objdir/$subdir/$binfile] then {
    warning "$binfile does not exist; tests suppressed."
} else {
    do_tests
}
