aboutsummaryrefslogtreecommitdiff
path: root/tests/runner.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-02-13 22:14:10 -0500
committerAlon Zakai <alonzakai@gmail.com>2012-02-13 22:14:10 -0500
commitb1a5987e6d8fdd07a0b8628c2a8ec2f8bab43aca (patch)
treecabfc17eb9970faba4bab1bc35c9cd310e4fd877 /tests/runner.py
parentfacf672f5eed5957e028151981f14f97ca74c748 (diff)
actually return the valid pointer in dynamic cast
Diffstat (limited to 'tests/runner.py')
-rwxr-xr-xtests/runner.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py
index 49020904..73bf67be 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -1549,6 +1549,25 @@ if 'benchmark' not in str(sys.argv) and 'sanity' not in str(sys.argv):
self.do_run(src, '*11,74,32,1012*\n*11*\n*22*')
def test_dynamic_cast(self):
+ src = r'''
+ #include <stdio.h>
+
+ struct Support {
+ virtual void f() {
+ printf("f()\n");
+ }
+ };
+
+ struct Derived : Support {
+ };
+
+ int main() {
+ Support * p = new Derived;
+ dynamic_cast<Derived*>(p)->f();
+ }
+ '''
+ self.do_run(src, 'f()\n')
+
src = '''
#include <stdio.h>