Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r83490 - trunk/libs/type_erasure/test
From: steven_at_[hidden]
Date: 2013-03-18 13:29:44


Author: steven_watanabe
Date: 2013-03-18 13:29:43 EDT (Mon, 18 Mar 2013)
New Revision: 83490
URL: http://svn.boost.org/trac/boost/changeset/83490

Log:
Test that overloading on the constness of this works.
Text files modified:
   trunk/libs/type_erasure/test/test_member.cpp | 17 +++++++++++++++++
   1 files changed, 17 insertions(+), 0 deletions(-)

Modified: trunk/libs/type_erasure/test/test_member.cpp
==============================================================================
--- trunk/libs/type_erasure/test/test_member.cpp (original)
+++ trunk/libs/type_erasure/test/test_member.cpp 2013-03-18 13:29:43 EDT (Mon, 18 Mar 2013)
@@ -98,6 +98,23 @@
     BOOST_CHECK_EQUAL(x.f1(5), 15);
 }
 
+struct model_overload_const_non_const {
+ int f1() { return 1; }
+ int f1() const { return 2; }
+};
+
+BOOST_AUTO_TEST_CASE(test_global_has_f1_overload_const_non_const) {
+ typedef ::boost::mpl::vector<
+ global_has_f1_0<int(), _self>,
+ global_has_f1_0<int(), const _self>,
+ copy_constructible<> > concept_type;
+ model_overload_const_non_const m;
+ any<concept_type> x1(m);
+ BOOST_CHECK_EQUAL(x1.f1(), 1);
+ const any<concept_type> x2(m);
+ BOOST_CHECK_EQUAL(x2.f1(), 2);
+}
+
 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
 
 BOOST_AUTO_TEST_CASE(test_global_has_f1_rv) {


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk