[Bug c++/44871] Invalid type mismatches while merging C and C++ sources
rguenth at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Fri Jul 9 13:01:00 GMT 2010
------- Comment #9 from rguenth at gcc dot gnu dot org 2010-07-09 13:01 -------
The following seems to work at least for the testcase:
Index: gcc/tree.c
===================================================================
--- gcc/tree.c (revision 161994)
+++ gcc/tree.c (working copy)
@@ -4298,6 +4298,18 @@ free_lang_data_in_type (tree type)
{
tree prev, member;
+ if (strcmp (lang_hooks.name, "GNU C++") == 0)
+ {
+ /* If this isn't an implicit typedef then this final
+ non-typedef name is not a struct tag. Clear its name.
+ See PR44871 for the glory details. */
+ if (TYPE_NAME (type)
+ && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
+ && !DECL_ORIGINAL_TYPE (TYPE_NAME (type))
+ /* DECL_IMPLICIT_TYPEDEF_P */
+ && !DECL_LANG_FLAG_2 (TYPE_NAME (type)))
+ TYPE_NAME (type) = NULL_TREE;
+ }
/* Note that TYPE_FIELDS can be shared across distinct
TREE_TYPEs. Therefore, if the first field of TYPE_FIELDS is
to be removed, we cannot set its TREE_CHAIN to NULL.
it will wreck debuginfo for T1 of course.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44871
More information about the Gcc-bugs
mailing list