This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] c++/PR28659


Hi, 

below a fix for a simple crasher, exposed by enum return values in templates 
with visibility attributes. it is a 4.2 regression.

bootstrapped, regtested on x86_64-unknown-linux. 



2006-08-14  Dirk Mueller  <dmueller@suse.de>

        * decl2.c (min_vis_r): Check for 
        TYPE_MAIN_DECL result.

        * g++.dg/ext/visibility/pr28569.C: New testcase.

--- cp/decl2.c
+++ cp/decl2.c
@@ -1547,7 +1547,8 @@ min_vis_r (tree *tp, int *walk_subtrees,
     }
   else if (CLASS_TYPE_P (*tp))
     {
-      if (!TREE_PUBLIC (TYPE_MAIN_DECL (*tp)))
+      tree main_decl = TYPE_MAIN_DECL (*tp);
+      if (main_decl && !TREE_PUBLIC (main_decl))
 	{
 	  *vis_p = VISIBILITY_ANON;
 	  return *tp;
--- testsuite/g++.dg/ext/visibility/pr28659.C	(revision 0)
+++ testsuite/g++.dg/ext/visibility/pr28659.C	(revision 0)
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* PR c++/28659 */
+
+enum ObjectDescriptionType
+{
+  AudioOutputDeviceType
+};
+template < enum ObjectDescriptionType T > class
+  __attribute__ ((visibility ("default"))) ObjectDescription
+{
+  ObjectDescription < T > &x ();
+};
+template < enum ObjectDescriptionType T  > 
+ObjectDescription < T > & ObjectDescription < T >::x ()
+{
+}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]