]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/28279 (ICE in finish_static_data_member_decl, at cp/decl2.c:716)
authorJason Merrill <jason@redhat.com>
Thu, 6 Jul 2006 18:39:39 +0000 (14:39 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 6 Jul 2006 18:39:39 +0000 (14:39 -0400)
        PR c++/28279
        * decl2.c (finish_static_data_member_decl): Don't assert
        TREE_PUBLIC.

From-SVN: r115228

gcc/cp/ChangeLog
gcc/cp/decl2.c
gcc/testsuite/g++.dg/template/anon2.C [new file with mode: 0644]

index 3d3952cb681bd088b51cc7f41c9db2d20f418352..b7929640c01434fe1a39e28843427197612c9b77 100644 (file)
@@ -1,3 +1,9 @@
+2006-07-06  Jason Merrill  <jason@redhat.com>
+
+       PR c++/28279
+       * decl2.c (finish_static_data_member_decl): Don't assert
+       TREE_PUBLIC.
+
 2006-07-05  Jason Merrill  <jason@redhat.com>
 
        PR c++/13983
index 0964bf5de849fca16dec7cc609c26af01a197f16..defeafbf5512d7ad75e59e1f54b63ea625a66ba5 100644 (file)
@@ -713,15 +713,13 @@ finish_static_data_member_decl (tree decl,
                                tree asmspec_tree,
                                int flags)
 {
-  gcc_assert (TREE_PUBLIC (decl));
-
   DECL_CONTEXT (decl) = current_class_type;
 
   /* We cannot call pushdecl here, because that would fill in the
      TREE_CHAIN of our decl.  Instead, we modify cp_finish_decl to do
      the right thing, namely, to put this decl out straight away.  */
 
-  if (! processing_template_decl)
+  if (! processing_template_decl && TREE_PUBLIC (decl))
     note_vague_linkage_var (decl);
 
   if (LOCAL_CLASS_P (current_class_type))
diff --git a/gcc/testsuite/g++.dg/template/anon2.C b/gcc/testsuite/g++.dg/template/anon2.C
new file mode 100644 (file)
index 0000000..75285ad
--- /dev/null
@@ -0,0 +1,15 @@
+// PR c++/28279
+// finish_static_data_member_decl was confused by the anonymous
+// namespace causing TREE_PUBLIC to be unset
+
+template<typename T>
+struct is_pointer_impl {
+    static const bool value = true;
+};
+
+namespace {
+  class prefix_name_mapper {};
+}
+
+static const bool val = is_pointer_impl<prefix_name_mapper>::value;
+