/* * Copyright 2016 The Emscripten Authors. All rights reserved. * Emscripten is available under two separate licenses, the MIT license and the * University of Illinois/NCSA Open Source License. Both these licenses can be * found in the LICENSE file. */ #include class CBase { virtual void dummy() {} }; class CDerived : public CBase { int a; }; class CDerivedest : public CDerived { float b; }; int main() { CBase *pa = new CBase; CBase *pb = new CDerived; CBase *pc = new CDerivedest; printf("a1: %d\n", dynamic_cast(pa) != NULL); printf("a2: %d\n", dynamic_cast(pa) != NULL); printf("a3: %d\n", dynamic_cast(pa) != NULL); printf("b1: %d\n", dynamic_cast(pb) != NULL); printf("b2: %d\n", dynamic_cast(pb) != NULL); printf("b3: %d\n", dynamic_cast(pb) != NULL); printf("c1: %d\n", dynamic_cast(pc) != NULL); printf("c2: %d\n", dynamic_cast(pc) != NULL); printf("c3: %d\n", dynamic_cast(pc) != NULL); return 0; }