https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114275

--- Comment #4 from Nathaniel Shead <nshead at gcc dot gnu.org> ---
I suspect there are a number of issues tied together here. Some of the things
I've discovered so far:

- 'tsubst_friend_class' calls 'lookup_name', which when called from a module
that doesn't export the class that was befriended fails to find it, and so it
substitutes in a new instance of that type (which then later fails
duplicate_decls).

- Instantiating an elaborated type specifier doesn't attach it to the module
the containing template was declared in.

- Sometimes it seems that the container of a MK_local_friend decl is not always
correctly streamed: in particular, in the comment 2 testcase the container
streamed is a complete type on write, but on read is not complete (TYPE_SIZE is
null) and so is not properly read on stream-in in the first place.

Additionally, it looks like you can hide some of the errors by making the
importer a named module, because on instantiation it only calls
'duplicate_decls' on names imported from a partition.

Reply via email to