------------------------------------------------------------ revno: 3229 committer: poy <p...@123gen.com> branch nick: trunk timestamp: Thu 2013-03-21 21:33:56 +0100 message: make sure the func detection sfinae works with virtual funcs modified: test/testsfinae.cpp
-- lp:dcplusplus https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk Your team Dcplusplus-team is subscribed to branch lp:dcplusplus. To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'test/testsfinae.cpp' --- test/testsfinae.cpp 2012-11-23 19:35:18 +0000 +++ test/testsfinae.cpp 2013-03-21 20:33:56 +0000 @@ -8,6 +8,9 @@ struct Base { void fbase1() { } + virtual void virt1() { } + virtual void virt2() { } + virtual void pure_virt() = 0; }; struct Funcs : Base { @@ -16,6 +19,8 @@ int f3() { return 0; } void f4(const string&) { } void f5(string&) { } + void virt1() { } + void pure_virt() { } }; template<typename T> @@ -27,11 +32,15 @@ HAS_FUNC(F4, void, f4(string())); HAS_FUNC(F5, void, f5(std::function<string&()>()())); HAS_FUNC(F6, void, fbase1()); + HAS_FUNC(F7, void, virt1()); + HAS_FUNC(F8, void, virt2()); + HAS_FUNC(F9, void, pure_virt()); // these should be false. HAS_FUNC(FN1, void, lol()); HAS_FUNC(FN2, bool, f1()); HAS_FUNC(FN3, bool, f3()); + HAS_FUNC(FN4, int, virt1()); bool test_F1() { return F1<T>::value; } bool test_F2() { return F2<T>::value; } @@ -39,10 +48,14 @@ bool test_F4() { return F4<T>::value; } bool test_F5() { return F5<T>::value; } bool test_F6() { return F6<T>::value; } + bool test_F7() { return F7<T>::value; } + bool test_F8() { return F8<T>::value; } + bool test_F9() { return F9<T>::value; } bool test_FN1() { return FN1<T>::value; } bool test_FN2() { return FN2<T>::value; } bool test_FN3() { return FN3<T>::value; } + bool test_FN4() { return FN4<T>::value; } bool i() { return i1(); @@ -62,10 +75,14 @@ ASSERT_EQ(true, x.test_F4()); ASSERT_EQ(true, x.test_F5()); ASSERT_EQ(true, x.test_F6()); + ASSERT_EQ(true, x.test_F7()); + ASSERT_EQ(true, x.test_F8()); + ASSERT_EQ(true, x.test_F9()); ASSERT_EQ(false, x.test_FN1()); ASSERT_EQ(false, x.test_FN2()); ASSERT_EQ(false, x.test_FN3()); + ASSERT_EQ(false, x.test_FN4()); ASSERT_EQ(true, x.i()); }
_______________________________________________ Mailing list: https://launchpad.net/~linuxdcpp-team Post to : linuxdcpp-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~linuxdcpp-team More help : https://help.launchpad.net/ListHelp