+ C++ ABI: pure virtual functions
[lightlibc++.git] / testcase / cxxabi / pure_virtual.cpp
blobe9a924d7afddd57a5117112a9145af7f74efec3d
1 /*
2 Permission is granted to use, modify, and / or redistribute at will.
4 This includes removing authorship notices, re-use of code parts in
5 other software (with or without giving credit), and / or creating a
6 commercial product based on it.
8 This permission is not revocable by the author.
10 This software is provided as-is. Use it at your own risk. There is
11 no warranty whatsoever, neither expressed nor implied, and by using
12 this software you accept that the author(s) shall not be held liable
13 for any loss of data, loss of service, or other damages, be they
14 incidental or consequential. Your only option other than accepting
15 this is not to use the software at all.
17 #include <cstdlib>
20 * NOTE: This testcase is supposed to fail during execution
21 * This testcase checks that a handler for pure virtual functions that are
22 * not properly set is called
25 class base
27 public:
28 base()
30 // f1 calls our pure virtual function,
31 // but derived is not yet constructed
32 f1();
35 void f1()
37 f2();
40 virtual void f2() = 0;
41 virtual ~base(){}
44 class derived : public base
46 public:
47 virtual void f2()
52 int main()
54 derived* d = new derived();
55 d->f2();
56 return EXIT_SUCCESS;