Jason,
I made a verifier that types not considered anonymous are not built
from types that are anonymous and that public types have TREE_PUBLIC
flag on their TYPE_DECLS (as that seem to be what tree.h says).

This catches two cases in C++ FE and several other cases elsewhere.
Does something like this make sense? I think bulitin_types are
generally public, but I am not quite sure about templates.

Honza

        * decl.c (record_builtin_type): Make builting types public.
        * pt.c (reduce_template_parm_level): Make TYPE_DECL public.
Index: decl.c
===================================================================
--- decl.c      (revision 212098)
+++ decl.c      (working copy)
@@ -3591,6 +3591,7 @@ record_builtin_type (enum rid rid_index,
       tdecl = build_decl (BUILTINS_LOCATION, TYPE_DECL, tname, type);
       DECL_ARTIFICIAL (tdecl) = 1;
       SET_IDENTIFIER_GLOBAL_VALUE (tname, tdecl);
+      TREE_PUBLIC (tdecl) = true;
     }
   if (rname)
     {
@@ -3598,6 +3599,7 @@ record_builtin_type (enum rid rid_index,
        {
          tdecl = build_decl (BUILTINS_LOCATION, TYPE_DECL, rname, type);
          DECL_ARTIFICIAL (tdecl) = 1;
+         TREE_PUBLIC (tdecl) = true;
        }
       SET_IDENTIFIER_GLOBAL_VALUE (rname, tdecl);
     }
Index: pt.c
===================================================================
--- pt.c        (revision 212098)
+++ pt.c        (working copy)
@@ -3623,6 +3623,8 @@ reduce_template_parm_level (tree index,
                         TREE_CODE (orig_decl), DECL_NAME (orig_decl), type);
       TREE_CONSTANT (decl) = TREE_CONSTANT (orig_decl);
       TREE_READONLY (decl) = TREE_READONLY (orig_decl);
+      if (TREE_CODE (decl) == TYPE_DECL)
+        TREE_PUBLIC (decl) = 1;
       DECL_ARTIFICIAL (decl) = 1;
       SET_DECL_TEMPLATE_PARM_P (decl);
 

Reply via email to