From 47e28751c015727d2632c5b459b0b1f360d74b7d Mon Sep 17 00:00:00 2001 From: syntheticpp Date: Wed, 11 Oct 2006 10:40:47 +0000 Subject: [PATCH] add friend injection test git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@708 7ec92016-0320-0410-acc4-a06ded1c099a --- test/RegressionTest/SmartPtrTest.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/test/RegressionTest/SmartPtrTest.h b/test/RegressionTest/SmartPtrTest.h index 7688801..0733ff1 100755 --- a/test/RegressionTest/SmartPtrTest.h +++ b/test/RegressionTest/SmartPtrTest.h @@ -19,6 +19,8 @@ #include "UnitTest.h" #include #include +#include + #if 0 // throw assert on failed test #define LOKI_assert(x) assert(x) @@ -28,6 +30,27 @@ using namespace Loki; +// friend injection +// see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28597 +class TestClass; +typedef SmartPtr Class; + +bool Compare( const Class& a, const Class& b ) +{ + return true; +} + +void friend_injection() +{ + std::vector vec; + std::sort( vec.begin(), vec.end(), Compare ); + std::nth_element( vec.begin(), vec.begin(), vec.end(), Compare ); + std::search( vec.begin(), vec.end(), + vec.begin(), vec.end(), Compare ); + Class a, b; + Compare( a, b ); +} + /////////////////////////////////////////////////////////////////////////////// // SmartPtrTest /////////////////////////////////////////////////////////////////////////////// @@ -63,6 +86,8 @@ public: return new TestClass(*this); } + + public: static int instances;