instantiate4.C: New test: -frepo does not generate needed virtual table
authorAlexandre Oliva <oliva@dcc.unicamp.br>
Sun, 11 Oct 1998 11:12:06 +0000 (11:12 +0000)
committerAlexandre Oliva <oliva@gcc.gnu.org>
Sun, 11 Oct 1998 11:12:06 +0000 (11:12 +0000)
* 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
gcc/testsuite/g++.old-deja/g++.pt/instantiate4.C [new file with mode: 0644]
gcc/testsuite/lib/old-dejagnu.exp

index b6a7f6d..f01ab05 100644 (file)
@@ -1,3 +1,10 @@
+1998-10-11  Alexandre Oliva  <oliva@dcc.unicamp.br>
+
+       * 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  <eslimi@loran.com>
 
        * 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 (file)
index 0000000..6cf4118
--- /dev/null
@@ -0,0 +1,29 @@
+// Build then link:
+
+// Special g++ Options: -frepo -Werror
+
+// Submitted by Melissa O'Neill <oneill@cs.sfu.ca>
+// the vtable of Foo<int> wouldn't be generated
+
+// excess errors test - XFAIL *-*-*
+
+template <typename A>
+struct Foo {
+   virtual void foo() {}
+};
+
+template <typename A>
+struct Bar {   
+   void bar();
+};
+
+template <typename A> 
+void Bar<A>::bar() {
+   Foo<A> oof;
+}
+
+int main () {
+    Bar<int> rab;
+    
+    rab.bar();
+}
index 30d2236..9512649 100644 (file)
@@ -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]