This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ PATCH] Fix -frepo (PR c++/34178, c++/34340, take 3)

Jakub Jelinek wrote:

> No, I'm talking about the original compilation, which creates the .rpo file.
> Perhaps even shorter testcase with ./cc1plus -frepo testcase.C is:
> struct A { int a; };
> template <typename T> struct D { static const A b; };
> template<typename T> const A D<T>::b = { 2 };
> template class D<A>;
> int main () { }
> Here there is just one static data member.
> finish_static_data_member_decl marks D<T>::b as TREE_USED because it is
> const. 

Do you really mean D<T> or D<A>?  TREE_USED on D<T>::b should not matter
as that's not a real thing; only D<A>::b might show up in the object file.

Anyhow, the explicit instantiation directive should result in us
emitting D<A>::b.  I don't think that -frepo should cause us not to emit
things that the user has explicitly instantiated.

I would expect that the right code in repo_emit_p would be:

  /* Variables that can appear in integral constant-expressions must
     be instantiated so that the values of th variables are
     available.  */
    return 2;
  /* Explicit instantiations should be handled normally even when using
     a repository.  */
    return 2;

Does that work?

Mark Mitchell
(650) 331-3385 x713

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]