decl2.c (import_export_decl): Because vtables always reference virtual functions...
authorMike Stump <mrs@wrs.com>
Tue, 13 Apr 1999 18:09:57 +0000 (18:09 +0000)
committerMike Stump <mrs@gcc.gnu.org>
Tue, 13 Apr 1999 18:09:57 +0000 (18:09 +0000)
* decl2.c (import_export_decl): Because vtables always reference
virtual functions, even if they are inlined, don't allow
-fno-implement-inlines to not emit them, instead, emit them with
the vtable.
* decl.c (start_function): Likewise.
Fixes vtable1.C

From-SVN: r26416

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/decl2.c
gcc/testsuite/g++.old-deja/g++.mike/vtable1.C [new file with mode: 0644]

index 179cd0c7c427e7618dbe1fd2b8449ebc5ee7fb61..de3261256dcbc444708371da58c1375db468e028 100644 (file)
@@ -1,3 +1,11 @@
+1999-04-13  Mike Stump  <mrs@wrs.com>
+
+       * decl2.c (import_export_decl): Because vtables always reference
+       virtual functions, even if they are inlined, don't allow
+       -fno-implement-inlines to not emit them, instead, emit them with
+       the vtable.
+       * decl.c (start_function): Likewise.
+
 1999-04-12  Jason Merrill  <jason@yorick.cygnus.com>
 
        * cp-tree.h (struct lang_type): Add com_interface.
index 89b136793bf5fdd6b64580acba268d19929870cb..70f93d2505922200365f21640c31ec326f62dcc2 100644 (file)
@@ -13260,7 +13260,8 @@ start_function (declspecs, declarator, attrs, pre_parsed_p)
        {
          DECL_EXTERNAL (decl1)
            = (interface_only
-              || (DECL_THIS_INLINE (decl1) && ! flag_implement_inlines));
+              || (DECL_THIS_INLINE (decl1) && ! flag_implement_inlines
+                  && !DECL_VINDEX (decl1)));
 
          /* For WIN32 we also want to put these in linkonce sections.  */
          maybe_make_one_only (decl1);
index 04114f7441788b972f6bd9a4c700518c7359c206..0ba19fdc8fa898d236520ab0cf5566555524dd3f 100644 (file)
@@ -2773,7 +2773,8 @@ import_export_decl (decl)
        {
          DECL_NOT_REALLY_EXTERN (decl)
            = ! (CLASSTYPE_INTERFACE_ONLY (ctype)
-                || (DECL_THIS_INLINE (decl) && ! flag_implement_inlines));
+                || (DECL_THIS_INLINE (decl) && ! flag_implement_inlines
+                    && !DECL_VINDEX (decl)));
 
          /* Always make artificials weak.  */
          if (DECL_ARTIFICIAL (decl) && flag_weak)
@@ -2803,7 +2804,8 @@ import_export_decl (decl)
        {
          DECL_NOT_REALLY_EXTERN (decl)
            = ! (CLASSTYPE_INTERFACE_ONLY (ctype)
-                || (DECL_THIS_INLINE (decl) && ! flag_implement_inlines));
+                || (DECL_THIS_INLINE (decl) && ! flag_implement_inlines
+                    && !DECL_VINDEX (decl)));
 
          /* Always make artificials weak.  */
          if (flag_weak)
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/vtable1.C b/gcc/testsuite/g++.old-deja/g++.mike/vtable1.C
new file mode 100644 (file)
index 0000000..260f93d
--- /dev/null
@@ -0,0 +1,12 @@
+// Build don't run:
+// Special g++ Options: -fno-implement-inlines 
+struct type {
+  virtual void m1();
+  virtual void m2() { }
+};
+
+void type::m1() { }
+
+int main() {
+  type t;
+}