blob: 4503d889c1713ce726e5baad4e0f1216424ea148 [file] [log] [blame]
Howard Hinnant2d6810f2012-02-01 20:53:21 +00001//===--------------- catch_member_function_pointer_01.cpp -----------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include <cassert>
11
12struct A
13{
14 void foo() {}
15 void bar() const {}
16};
17
18typedef void (A::*mf1)();
19typedef void (A::*mf2)() const;
20
21void test1()
22{
23 try
24 {
25 throw &A::foo;
26 assert(false);
27 }
28 catch (mf2)
29 {
30 assert(false);
31 }
32 catch (mf1)
33 {
34 }
35}
36
37void test2()
38{
39 try
40 {
41 throw &A::bar;
42 assert(false);
43 }
44 catch (mf1)
45 {
46 assert(false);
47 }
48 catch (mf2)
49 {
50 }
51}
52
53int main()
54{
55 test1();
56 test2();
57}