1 //===--------------- 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 12 struct A 13 { fooA14 void foo() {} barA15 void bar() const {} 16 }; 17 18 typedef void (A::*mf1)(); 19 typedef void (A::*mf2)() const; 20 test1()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 test2()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 main()53int main() 54 { 55 test1(); 56 test2(); 57 } 58