This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ PATCH to c++/28279
- From: Jason Merrill <jason at redhat dot com>
- To: "gcc-patches >> GCC Patches" <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 06 Jul 2006 14:35:49 -0400
- Subject: C++ PATCH to c++/28279
I suspected there would be a few other places that would need to be
tweaked because of the change making members of the anonymous namespace
!TREE_PUBLIC. This is one.
Tested x86_64-pc-linux-gnu, applied to trunk.
2006-07-06 Jason Merrill <jason@redhat.com>
PR c++/28279
* decl2.c (finish_static_data_member_decl): Don't assert
TREE_PUBLIC.
Index: cp/decl2.c
===================================================================
*** cp/decl2.c (revision 115202)
--- cp/decl2.c (working copy)
*************** finish_static_data_member_decl (tree dec
*** 713,727 ****
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)
note_vague_linkage_var (decl);
if (LOCAL_CLASS_P (current_class_type))
--- 713,725 ----
tree asmspec_tree,
int flags)
{
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 && TREE_PUBLIC (decl))
note_vague_linkage_var (decl);
if (LOCAL_CLASS_P (current_class_type))
Index: testsuite/g++.dg/template/anon2.C
===================================================================
*** testsuite/g++.dg/template/anon2.C (revision 0)
--- testsuite/g++.dg/template/anon2.C (revision 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;
+