OSDN Git Service

PR c++/14688
authordannysmith <dannysmith@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 25 Sep 2007 00:29:42 +0000 (00:29 +0000)
committerdannysmith <dannysmith@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 25 Sep 2007 00:29:42 +0000 (00:29 +0000)
* config/i386/i386.c (ix86_comp_type_attributes): Check
METHOD_TYPE too.

cp
* search.c (check_final_overrider): Fail if
targetm.comp_type_attributes returns 0.

testsuite
* g++.dg/inherit/override_attribs.C: New file.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@128740 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/cp/ChangeLog
gcc/cp/search.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/inherit/override-attribs.C [new file with mode: 0644]

index c1376d4..07b24d7 100644 (file)
@@ -1,3 +1,9 @@
+2007-09-24  Danny Smith  <dannysmith@user.sourceforge.net>
+
+       PR c++/14688
+       * config/i386/i386.c (ix86_comp_type_attributes): Check
+       METHOD_TYPE too.
+
 2007-09-24  Roman Zippel <zippel@linux-m68k.org> 
 
        * config/m68k/m68k.h (ASM_OUTPUT_ALIGN_WITH_NOP): New, use
index c01bcbb..a9ca27b 100644 (file)
@@ -3118,7 +3118,8 @@ ix86_comp_type_attributes (const_tree type1, const_tree type2)
   /* Check for mismatch of non-default calling convention.  */
   const char *const rtdstr = TARGET_RTD ? "cdecl" : "stdcall";
 
-  if (TREE_CODE (type1) != FUNCTION_TYPE)
+  if (TREE_CODE (type1) != FUNCTION_TYPE
+      && TREE_CODE (type1) != METHOD_TYPE)
     return 1;
 
   /* Check for mismatched fastcall/regparm types.  */
@@ -7839,6 +7840,7 @@ get_dllimport_decl (tree decl)
   set_mem_alias_set (rtl, ix86_GOT_alias_set ());
 
   SET_DECL_RTL (to, rtl);
+  SET_DECL_ASSEMBLER_NAME (to, get_identifier (name));
 
   return to;
 }
index 6950166..0effc4b 100644 (file)
@@ -1,3 +1,10 @@
+2007-09-24  Danny Smith  <dannysmith@user.sourceforge.net>
+
+       PR c++/14688
+        * search.c (check_final_overrider): Fail if
+       targetm.comp_type_attributes returns 0.
+
+
 2007-09-24  Jason Merrill  <jason@redhat.com>
 
        PR c++/33239
index 4371eb4..13e252e 100644 (file)
@@ -33,6 +33,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "rtl.h"
 #include "output.h"
 #include "toplev.h"
+#include "target.h"
 
 static int is_subobject_of_p (tree, tree);
 static tree dfs_lookup_base (tree, void *);
@@ -1901,6 +1902,15 @@ check_final_overrider (tree overrider, tree basefn)
       return 0;
     }
 
+  /* Check for conflicting type attributes.  */
+  if (!targetm.comp_type_attributes (over_type, base_type))
+    {
+      error ("conflicting type attributes specified for %q+#D", overrider);
+      error ("  overriding %q+#D", basefn);
+      DECL_INVALID_OVERRIDER_P (overrider) = 1;
+      return 0;
+    }
+
   return 1;
 }
 
index f4da1dd..6caa320 100644 (file)
@@ -1,3 +1,8 @@
+2007-09-24  Danny Smith  <dannysmith@user.sourceforge.net>
+
+       PR c++/14688
+       * g++.dg/inherit/override_attribs.C: New file.
+
 2007-09-23  Tobias Schlüter  <tobi@gcc.gnu.org>
 
        PR fortran/33269
diff --git a/gcc/testsuite/g++.dg/inherit/override-attribs.C b/gcc/testsuite/g++.dg/inherit/override-attribs.C
new file mode 100644 (file)
index 0000000..44a1ea4
--- /dev/null
@@ -0,0 +1,22 @@
+// PR c++/14688
+// { dg-do compile { target i?86-*-* } }
+class one
+{
+public:
+  virtual void
+  test(void* value);  // { dg-error "overriding" }
+};
+
+class two : public one
+{
+public:
+  void  __attribute__((regparm(2)))
+  test(void* value);  // { dg-error "conflicting type attributes"  }
+};
+
+class three : public one
+{
+public:
+  void __attribute__ ((cdecl))
+  test(void* value);  // OK
+};