OSDN Git Service

gcc/cp
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 8 Nov 2007 19:50:38 +0000 (19:50 +0000)
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 8 Nov 2007 19:50:38 +0000 (19:50 +0000)
2007-11-08  Andrew Pinski  <pinskia@gmail.com>
PR c++/30297:
* tree.c (decl_linkage): Fields have no linkage.
gcc/testsuite
PR c++/30297:
* g++.dg/inherit/pr30297.C: New file.

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

gcc/cp/ChangeLog
gcc/cp/tree.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/inherit/pr30297.C [new file with mode: 0644]

index e28f582..3a99fba 100644 (file)
@@ -1,3 +1,8 @@
+2007-11-08  Andrew Pinski  <pinskia@gmail.com>
+
+       PR c++/30297:
+       * tree.c (decl_linkage): Fields have no linkage.
+
 2007-11-08  Daniel Jacobowitz  <dan@codesourcery.com>
 
        * class.c (build_ctor_vtbl_group): Lay out the new type and decl.
index c2b4af0..2a7cd3a 100644 (file)
@@ -2493,6 +2493,10 @@ decl_linkage (tree decl)
   if (!DECL_NAME (decl))
     return lk_none;
 
+  /* Fields have no linkage.  */
+  if (TREE_CODE (decl) == FIELD_DECL)
+    return lk_none;
+
   /* Things that are TREE_PUBLIC have external linkage.  */
   if (TREE_PUBLIC (decl))
     return lk_external;
index e04e5e1..ede1c09 100644 (file)
@@ -1,3 +1,8 @@
+2007-11-08  Tom Tromey  <tromey@redhat.com>
+
+       PR c++/30297:
+       * g++.dg/inherit/pr30297.C: New file.
+
 2007-11-08  Danny Smith  <dannysmith@users.sourceforge.net>
 
        * gcc.dg/compat/struct-layout-1_generate.c (dg-options) Add
diff --git a/gcc/testsuite/g++.dg/inherit/pr30297.C b/gcc/testsuite/g++.dg/inherit/pr30297.C
new file mode 100644 (file)
index 0000000..222d9ab
--- /dev/null
@@ -0,0 +1,11 @@
+// Regression test for ICE from PR c++/30297.
+
+struct A
+{
+  int i;
+};
+
+extern "C" struct B : A
+{
+  A::i;
+};