[C++ PATCH] Fix -frepo (PR c++/36364)
Mark Mitchell
mark@codesourcery.com
Tue Jun 24 21:23:00 GMT 2008
Jakub Jelinek wrote:
> std::basic_string <char, std::char_traits <char>, __gnu_cxx::__mt_alloc <char> > s;
> doesn't link with -frepo. The problem is a static const data member with
> initializer, which repo_emit_p returns 2 for (to make sure it is properly
> optimized out when possible), but then import_export_decl sees the
> -frepo implied -fno-implicit-templates and doesn't emit it at all.
If I understand correctly, the problem is that we have a static data
member of a template which is marked as required by collect2, but then
when we recompile the file, is not actually emitted. Is that right?
If so, I think the fix is to honor IDENTIFIER_REPO_CHOSEN for the
VAR_DECL case of a static data member initialized by an integral
constant expression. Change the code in this test:
if (DECL_INTEGRAL_CONSTANT_VAR_P (decl)
&& DECL_CLASS_SCOPE_P (decl))
to (1) add the variable to pending_repo, and (2) if
IDENTIFIER_REPO_CHOSEN return 1, otherwise return 2. Probably the:
if (!DECL_REPO_AVAILABLE...)
block should be factored into a helper function.
Does that work?
--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713
More information about the Gcc-patches
mailing list