From 075e0395b4864e54d4eaaddb789a6b210b433293 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Dapena=20Paz?= Date: Fri, 1 Jun 2018 18:30:33 +0000 Subject: GCC6: workaround bug with external class template linking. In the case of ByteStringView and WideStringView, non official build fails to link in GCC 6.3 or older. But it works in GCC 7.2. A workaround for this problem is avoiding declaring in same file extern and explicit class template for them. It seems to be related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57728 though that bug is supposed to be already fixed in 6.3.0. Change-Id: Ia6323f23138c0c11e59ce7aa31da1f6c11bc4a5a Reviewed-on: https://pdfium-review.googlesource.com/33270 Commit-Queue: Tom Sepez Reviewed-by: Tom Sepez --- core/fxcrt/string_view_template.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'core') diff --git a/core/fxcrt/string_view_template.h b/core/fxcrt/string_view_template.h index 1780e47b03..d774e3f4bd 100644 --- a/core/fxcrt/string_view_template.h +++ b/core/fxcrt/string_view_template.h @@ -234,8 +234,12 @@ inline bool operator<(const T* lhs, const StringViewTemplate& rhs) { return rhs > lhs; } +// Workaround for one of the cases external template classes are +// failing in GCC before version 7 with -O0 +#if !defined(__GNUC__) || __GNUC__ >= 7 extern template class StringViewTemplate; extern template class StringViewTemplate; +#endif using ByteStringView = StringViewTemplate; using WideStringView = StringViewTemplate; -- cgit v1.2.3