1//===----------------- catch_member_data_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 const int i; 15 int j; 16}; 17 18typedef const int A::*md1; 19typedef int A::*md2; 20 21void test1() 22{ 23 try 24 { 25 throw &A::i; 26 assert(false); 27 } 28 catch (md2) 29 { 30 assert(false); 31 } 32 catch (md1) 33 { 34 } 35} 36 37void test2() 38{ 39 try 40 { 41 throw &A::j; 42 assert(false); 43 } 44 catch (md1) 45 { 46 assert(false); 47 } 48 catch (md2) 49 { 50 } 51} 52 53int main() 54{ 55 test1(); 56 test2(); 57} 58