include/rtl/stringconcat.hxx | 5 +++++ 1 file changed, 5 insertions(+)
New commits: commit 7fcfc39232d2fea7078c15552ee092b973e9175b Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Tue Mar 28 10:14:58 2023 +0200 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Tue Mar 28 10:58:45 2023 +0000 Fix build for recent GCC ...after 58dd5870a77344754ea459d8423d1b3787a6a813 "Avoid dangling references to temporary O[U]StringConcatMarker instances" caused e.g. > In file included from /home/tdf/lode/jenkins/workspace/lo_callgrind_linux/include/rtl/string.hxx:49, > from /home/tdf/lode/jenkins/workspace/lo_callgrind_linux/include/rtl/ustring.hxx:43, > from /home/tdf/lode/jenkins/workspace/lo_callgrind_linux/include/osl/module.hxx:31, > from /home/tdf/lode/jenkins/workspace/lo_callgrind_linux/sal/osl/all/loadmodulerelative.cxx:26: > /home/tdf/lode/jenkins/workspace/lo_callgrind_linux/include/rtl/stringconcat.hxx:468:8: error: partial specialization ‘struct rtl::StringConcat<C, rtl::StringConcatMarker<C>, T2, Dummy>’ is not more specialized than [-fpermissive] > 468 | struct StringConcat<C, StringConcatMarker<C>, T2, Dummy> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > /home/tdf/lode/jenkins/workspace/lo_callgrind_linux/include/rtl/stringconcat.hxx:190:8: note: primary template ‘template<class C, class T1, class T2, typename std::enable_if<(allowStringConcat<C, T1> && allowStringConcat<C, T2>), int>::type <anonymous> > struct rtl::StringConcat’ > 190 | struct StringConcat > | ^~~~~~~~~~~~ (<https://ci.libreoffice.org/job/lo_callgrind_linux/13174/>) with GCC 11.02. (But what fixes it for recent versions of GCC would start to fail with > In file included from sal/osl/all/loadmodulerelative.cxx:26: > In file included from include/osl/module.hxx:31: > In file included from include/rtl/ustring.hxx:43: > In file included from include/rtl/string.hxx:49: > include/rtl/stringconcat.hxx:468:8: error: non-type template argument specializes a template parameter with dependent type 'std::enable_if_t<allowStringConcat<C, T1> && allowStringConcat<C, T2>, int>' (aka 'typename enable_if<allowStringConcat<C, T1> && allowStringConcat<C, T2>, int>::type') > struct StringConcat<C, StringConcatMarker<C>, T2> > ^ > include/rtl/stringconcat.hxx:189:125: note: template parameter is declared here > template <typename C, typename T1, typename T2, std::enable_if_t<allowStringConcat<C, T1> && allowStringConcat<C, T2>, int> = 0 > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ for e.g. Clang 17 trunk.) Change-Id: I6110d5a2813b561748654065e76bb4b6ab2f82d8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149644 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/include/rtl/stringconcat.hxx b/include/rtl/stringconcat.hxx index c94f8b919e14..da32c7982792 100644 --- a/include/rtl/stringconcat.hxx +++ b/include/rtl/stringconcat.hxx @@ -464,8 +464,13 @@ using OUStringConcatMarker = StringConcatMarker<sal_Unicode>; template<typename C> constexpr bool allowStringConcat<C, StringConcatMarker<C>> = true; +#if defined __GNUC__ && !defined __clang__ +template <typename C, typename T2> +struct StringConcat<C, StringConcatMarker<C>, T2> +#else template <typename C, typename T2, std::enable_if_t<allowStringConcat<C, T2>, int> Dummy> struct StringConcat<C, StringConcatMarker<C>, T2, Dummy> +#endif { public: StringConcat( const T2& right_ ) : right( right_ ) {}