[PATCH] Add missing explicit instantiation for std::lower_bound template
Tue Feb 5 16:10:00 GMT 2013
On 02/04/2013 04:53 PM, Dodji Seketeli wrote:
> Since commit r195676, it looks like
> libstdc++-v3/src/c++11/hashtable_c++0x.cc is missing an explicit
> instantiation for std::lower_bound. This leads to libstdc++.so having
> the symbol for that (missing) instantiation be undefined, thus
> preventing executables from being linked with libstdc++.
Note that I can confirm this only if I build with less optimization than
the default -O2, say -O. That may explain why nobody noticed earlier.
> The patchlet below seems to fixed the issue for me.
Indeed, I think we want something like that. Thanks. In terms of nits,
formatting and types (who knows, maybe on some systems a std::size_t is
an unsigned long long), I would write something like the attached.
Please double check that it works for you and go ahead.
-------------- next part --------------
--- hashtable_c++0x.cc (revision 195759)
+++ hashtable_c++0x.cc (working copy)
@@ -94,4 +94,11 @@ namespace __detail
} // namespace __detail
+ // Instantiation.
+ const unsigned long*
+ lower_bound<const unsigned long*, size_t>(const unsigned long*,
+ const unsigned long*,
+ const size_t&);
} // namespace std
More information about the Gcc-patches