On Tue, Feb 19, 2019 at 10:53 PM Richard Biener <richard.guent...@gmail.com> wrote: > On Wed, Feb 20, 2019 at 2:58 AM Jason Merrill <ja...@redhat.com> wrote: > > > > A type in an anonymous namespace can never be merged with one from > > another translation unit, so a member of such a type is always its own > > prevailing decl. > > > > I don't really understand the LTO concept of prevailing decl, or why we > > don't > > get here if the destructor is defined, but this seems reasonable and fixes > > the > > bug. > > We're probably not supposed to end up here but get the "precomputed" > prevailing decl from symtab merging. Honza should know more precisely. > The resolution file does have an entry for the UNDEF destructor. > > Does this make the testcase invalid btw? There's no way another TU > can inject a definition into the same anonymous namespace, no?
Correct. The destructor is needed to destroy 'c', and there's no way it could be defined in another TU, so the testcase will fail to link. So we could probably reject the testcase (in cgraph?) before we touch LTO at all. > And does the point of instantiation really determine the containing > namespace of the class? No. a<f> isn't really in an anonymous namespace, but since f is, a<f> also gets internal linkage. So type_in_anonymous_namespace_p is a somewhat misleading name; perhaps type_internal_p? type_nonpublic_p? Jason