aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralon@honor <none@none>2010-10-23 20:37:49 -0700
committeralon@honor <none@none>2010-10-23 20:37:49 -0700
commitfcddeb2e6455db795e86be78f1679bbfeb27c52d (patch)
tree03bc2ad82583dae8b35b99cc992ac28d66eac150
parentf221a9bada6e054c0bf6a99db1bb0c1f1d8d349d (diff)
support for pure virtual functions
-rw-r--r--src/library.js4
-rw-r--r--tests/runner.py11
2 files changed, 12 insertions, 3 deletions
diff --git a/src/library.js b/src/library.js
index b276eba8..61149e2d 100644
--- a/src/library.js
+++ b/src/library.js
@@ -165,6 +165,10 @@ var Library = {
return ret;
},
+ __cxa_pure_virtual: function() {
+ throw 'Pure virtual function called!';
+ },
+
// iostream
_ZNSt8ios_base4InitC1Ev: function() {
diff --git a/tests/runner.py b/tests/runner.py
index 67e3cfba..879f3cbc 100644
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -479,21 +479,26 @@ if 'benchmark' not in sys.argv:
def test_polymorph(self):
src = '''
#include <stdio.h>
- struct Parent {
+ struct Pure {
+ virtual int implme() = 0;
+ };
+ struct Parent : Pure {
virtual int getit() { return 11; };
+ int implme() { return 32; }
};
struct Child : Parent {
int getit() { return 74; }
+ int implme() { return 1012; }
};
int main()
{
Parent *x = new Parent();
Parent *y = new Child();
- printf("*%d,%d*\\n", x->getit(), y->getit());
+ printf("*%d,%d,%d,%d*\\n", x->getit(), y->getit(), x->implme(), y->implme());
return 0;
}
'''
- self.do_test(src, '*11,74*')
+ self.do_test(src, '*11,74,32,1012*')
def test_funcptr(self):
src = '''