Closed Bug 69289 Opened 24 years ago Closed 24 years ago

|Substring| doesn't compile on gcc 2.7.2.3

Categories

(Core :: XPCOM, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla0.9

People

(Reporter: dbaron, Assigned: scc)

References

Details

The |Substring| function (defined as an overloaded pair of function templates in nsAReadableString.h) doesn't compile on gcc 2.7.2.3 if the first argument needs a conversion to get to |basic_nsAReadableString<charT>&|. This causes bustage and has been fixed in the tree both with NS_READABLE_CAST and with direct construction of an nsPromiseSubstring<charT>. It gives the error: /builds/seamonkey/mozilla/netwerk/protocol/about/src/nsAboutProtocolHandler.cpp:139: type unification failed for function template `template <class CharT> nsPromiseSubstring<...> Substring(basic_nsAReadableString<...> &, unsigned int, unsigned int)' If I comment out the first of the two overloaded function templates, it gives the error: /builds/seamonkey/mozilla/netwerk/protocol/about/src/nsAboutProtocolHandler.cpp:139: type unification failed for function template `template <class CharT> nsPromiseSubstring<...> Substring(basic_nsAReadableString<...> &, nsReadingIterator<...> &, nsReadingIterator<...> &)' If I change nsAReadableString.h to un-templatize the function (i.e., just provide 2 versions of each, one for charT == char and one for charT == PRUnichar), it compiles without NS_READABLE_CAST. Perhaps we should do this to avoid bustage, perhaps based on some autoconf test (although I don't think it would do any harm for other platforms...)?
Scratch that un-templatizing suggestion -- it didn't link, at least not with gcc 2.96 (RH).
Oops! The linker errors were because I forgot to declare the functions |inline|.
OK, the un-templatizing scheme sounds like the right thing to do then.
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla0.9
See patch in bug #69940.
[r|sr]=waterson, pick one.
patch (from bug #69940) checked in.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Blocks: 70090
Component: String → XPCOM
You need to log in before you can comment on or make changes to this bug.