From 0126020166c4f3bc6a262125ec51a99de8379c4b Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Sun, 11 Oct 1998 11:12:06 +0000 Subject: [PATCH] instantiate4.C: New test: -frepo does not generate needed virtual table * g++.old-deja/g++.pt/instantiate4.C: New test: -frepo does not generate needed virtual table * lib/old-dejagnu.exp (old-dejagnu): support `Build then link:' From-SVN: r22984 --- gcc/testsuite/ChangeLog | 7 +++++ .../g++.old-deja/g++.pt/instantiate4.C | 29 +++++++++++++++++++ gcc/testsuite/lib/old-dejagnu.exp | 16 +++++++++- 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/instantiate4.C diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b6a7f6d9f74c..f01ab0574c32 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +1998-10-11 Alexandre Oliva + + * g++.old-deja/g++.pt/instantiate4.C: New test: -frepo does not + generate needed virtual table + + * lib/old-dejagnu.exp (old-dejagnu): support `Build then link:' + 1998-10-10 Dariush Eslimi * g++.old-deja/g++.ext/typeof1.C: New test; typeof based on diff --git a/gcc/testsuite/g++.old-deja/g++.pt/instantiate4.C b/gcc/testsuite/g++.old-deja/g++.pt/instantiate4.C new file mode 100644 index 000000000000..6cf4118fdc3f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/instantiate4.C @@ -0,0 +1,29 @@ +// Build then link: + +// Special g++ Options: -frepo -Werror + +// Submitted by Melissa O'Neill +// the vtable of Foo wouldn't be generated + +// excess errors test - XFAIL *-*-* + +template +struct Foo { + virtual void foo() {} +}; + +template +struct Bar { + void bar(); +}; + +template +void Bar::bar() { + Foo oof; +} + +int main () { + Bar rab; + + rab.bar(); +} diff --git a/gcc/testsuite/lib/old-dejagnu.exp b/gcc/testsuite/lib/old-dejagnu.exp index 30d2236d423b..95126492e4de 100644 --- a/gcc/testsuite/lib/old-dejagnu.exp +++ b/gcc/testsuite/lib/old-dejagnu.exp @@ -196,7 +196,7 @@ proc old-dejagnu { compiler prog cflagsx default_cflags libs } { # is right. If no such Special Options are found, $default_cflags is used. # FIXME: Can there be multiple lines of these? # -# Other keywords: "Build don't link:", "Build don't run:". +# Other keywords: "Build don't link:", "Build don't run:", "Build then link:". set name "[file tail [file dirname $prog]]/[file tail $prog]" @@ -239,6 +239,15 @@ proc old-dejagnu { compiler prog cflagsx default_cflags libs } { verbose "Will compile $prog to object" 3 } + set tmp [lindex [grep $prog "Build then link:"] 0] + if ![string match "" $tmp] then { + set compile_type "object" + set runflag 2 + set final_output "$output" + set output "$tmpdir/[file tail [file rootname $prog]].o" + verbose "Will compile $prog to object, then link it" 3 + } + set tmp [lindex [grep $prog "Build don.t run:"] 0] if ![string match "" $tmp] then { set runflag 0 @@ -399,6 +408,11 @@ proc old-dejagnu { compiler prog cflagsx default_cflags libs } { # we can't run a.out when the compilation fails. remote_file build delete $output set comp_output [${tool}_target_compile $prog $output $compile_type $cflags] + if { $runflag == 2 && [file exists $output] } then { + set runflag 0 + set comp_output [concat $comp_output [${tool}_target_compile $output $final_output "executable" $cflags]] + set output $final_output + } # Delete things like "ld.so: warning" messages. set comp_output [prune_warnings $comp_output] -- 2.43.5