Author: Wim Lavrijsen <[email protected]>
Branch: reflex-support
Changeset: r62821:c23edb1d3fd2
Date: 2013-03-26 13:48 -0700
http://bitbucket.org/pypy/pypy/changeset/c23edb1d3fd2/

Log:    test that overload order remains unchanged on 'const'

diff --git a/pypy/module/cppyy/test/advancedcpp.cxx 
b/pypy/module/cppyy/test/advancedcpp.cxx
--- a/pypy/module/cppyy/test/advancedcpp.cxx
+++ b/pypy/module/cppyy/test/advancedcpp.cxx
@@ -114,3 +114,11 @@
 long my_templated_method_class::get_float_size()  { return 
(long)sizeof(float); }
 long my_templated_method_class::get_double_size() { return 
(long)sizeof(double); }
 long my_templated_method_class::get_self_size()   { return 
(long)sizeof(my_templated_method_class); }
+
+
+// overload order testing
+int overload_one_way::gime() const { return 1; }
+std::string overload_one_way::gime() { return "aap"; }
+
+std::string overload_the_other_way::gime() { return "aap"; }
+int overload_the_other_way::gime() const { return 1; }
diff --git a/pypy/module/cppyy/test/advancedcpp.h 
b/pypy/module/cppyy/test/advancedcpp.h
--- a/pypy/module/cppyy/test/advancedcpp.h
+++ b/pypy/module/cppyy/test/advancedcpp.h
@@ -1,4 +1,5 @@
 #include <new>
+#include <string>
 #include <vector>
 
 
@@ -416,3 +417,17 @@
 
 typedef my_templated_method_class my_typedef_t;
 template long my_templated_method_class::get_size<my_typedef_t>();
+
+
+//===========================================================================
+class overload_one_way {           // overload order testing
+public:
+    int gime() const;
+    std::string gime();
+};
+
+class overload_the_other_way {
+public:
+   std::string gime();
+   int gime() const;
+};
diff --git a/pypy/module/cppyy/test/advancedcpp.xml 
b/pypy/module/cppyy/test/advancedcpp.xml
--- a/pypy/module/cppyy/test/advancedcpp.xml
+++ b/pypy/module/cppyy/test/advancedcpp.xml
@@ -53,4 +53,7 @@
   <class name="my_templated_method_class" />
   <class name="my_typedef_t" />
 
+  <class name="overload_one_way" />
+  <class name="overload_the_other_way" />
+
 </lcgdict>
diff --git a/pypy/module/cppyy/test/advancedcpp_LinkDef.h 
b/pypy/module/cppyy/test/advancedcpp_LinkDef.h
--- a/pypy/module/cppyy/test/advancedcpp_LinkDef.h
+++ b/pypy/module/cppyy/test/advancedcpp_LinkDef.h
@@ -78,4 +78,7 @@
 #pragma link C++ class my_templated_method_class;
 #pragma link C++ typedef my_typedef_t;
 
+#pragma link C++ class overload_one_way;
+#pragma link C++ class overload_the_other_way;
+
 #endif
diff --git a/pypy/module/cppyy/test/test_advancedcpp.py 
b/pypy/module/cppyy/test/test_advancedcpp.py
--- a/pypy/module/cppyy/test/test_advancedcpp.py
+++ b/pypy/module/cppyy/test/test_advancedcpp.py
@@ -629,3 +629,11 @@
         assert b.__eq__(a) == True
         assert a.__eq__(a) == False
         assert b.__eq__(b) == False
+
+    def test21_overload_order_with_proper_return(self):
+        """Test return type against proper overload w/ const and covariance"""
+
+        import cppyy
+
+        assert cppyy.gbl.overload_one_way().gime() == 1
+        assert cppyy.gbl.overload_the_other_way().gime() == "aap"
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to