diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2012-12-05 21:55:29 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2012-12-06 13:35:19 +0100 |
commit | f0d75874c3106b9e25e36ff338c7935813ad0c11 (patch) | |
tree | 4e669cf12da7f09e54281ace7d8bfc18ba83510d /sal/inc/rtl | |
parent | 9b7ec76111ed966e93f6e0802aa6c8e021dcd4a8 (diff) |
unittest for fast string operator+ not allowing unwanted combinations
Change-Id: I5891efcec7db373407a661636108fd979839db52
Diffstat (limited to 'sal/inc/rtl')
-rw-r--r-- | sal/inc/rtl/stringconcat.hxx | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sal/inc/rtl/stringconcat.hxx b/sal/inc/rtl/stringconcat.hxx index 2b4fc31f60c6..a6e3467209e3 100644 --- a/sal/inc/rtl/stringconcat.hxx +++ b/sal/inc/rtl/stringconcat.hxx @@ -260,6 +260,23 @@ typename internal::Enable< OUStringConcat< T1, T2 >, ToStringHelper< T1 >::allow return OUStringConcat< T1, T2 >( left, right ); } +#ifdef RTL_STRING_UNITTEST_CONCAT +// Special overload to catch the remaining invalid combinations. The helper struct must +// be used to make this operator+ overload a worse choice than all the existing overloads above. +struct StringConcatInvalid + { + template< typename T > + StringConcatInvalid( const T& ) {} + }; +template< typename T > +inline +int operator+( const StringConcatInvalid&, const T& ) + { + rtl_string_unittest_invalid_concat = true; + return 0; // doesn't matter + } +#endif + } // namespace #endif |