Hi, TREE_PUBLIC of TYPE_DECL is defined to say if the type is public: /* In a VAR_DECL, FUNCTION_DECL, NAMESPACE_DECL or TYPE_DECL, nonzero means name is to be accessible from outside this translation unit. In an IDENTIFIER_NODE, nonzero means an external declaration accessible from outside this translation unit was previously seen for this name in an inner scope. */ #define TREE_PUBLIC(NODE) ((NODE)->base.public_flag)
This is properly honored by C++ FE but other FEs are bit random, which in turn confuses type_in_anonymous_namespace_p predicate that leads to flase poistives on type mismatch warnings. I used to be able to get around by checking only C++ types at LTO time, but with type checking in lto-symtab I can not, because I do want to compare type compatibility cross translation units and cross languages and we have no reliable way to say what type originated as C++ and what did not. This fixed TYPE_STUB_DECl construction in C frontend. I will check other FEs separately. I can also add way to recognize C++ types, but I think it is good idea to make type representation consistent across FEs. Bootstrapped/regtested x86_64-linux, OK? Honza * c-decl.c (pushtag): Declare type as public. Index: c/c-decl.c =================================================================== --- c/c-decl.c (revision 222981) +++ c/c-decl.c (working copy) @@ -1563,6 +1563,7 @@ pushtag (location_t loc, tree name, tree TYPE_STUB_DECL (type) = pushdecl (build_decl (loc, TYPE_DECL, NULL_TREE, type)); + TREE_PUBLIC (TYPE_STUB_DECL (type)) = 1; /* An approximation for now, so we can tell this is a function-scope tag. This will be updated in pop_scope. */