1 // Copyright 2018 The Emscripten Authors. All rights reserved. 2 // Emscripten is available under two separate licenses, the MIT license and the 3 // University of Illinois/NCSA Open Source License. Both these licenses can be 4 // found in the LICENSE file. 5 6 #include <iostream> 7 8 struct base_1 9 { 10 std::string v; 11 }; 12 13 struct base_2 14 { 15 std::string v; 16 }; 17 18 struct derived : base_1, base_2 19 { derivedderived20 derived() 21 { 22 base_1::v = "a"; 23 base_2::v = "b"; 24 } 25 }; 26 main()27int main() 28 { 29 try 30 { 31 throw derived(); 32 } 33 catch (const base_2&) 34 { 35 try 36 { 37 std::rethrow_exception(std::current_exception()); 38 } 39 catch (const base_1& ex) 40 { 41 std::cout << ex.v << std::endl; 42 } 43 } 44 45 return 0; 46 } 47