1f45c19578801a33c8518ffc95ecb17d92f38c9ebKostya Serebryany// See http://llvm.org/bugs/show_bug.cgi?id=11468 2f45c19578801a33c8518ffc95ecb17d92f38c9ebKostya Serebryany#include <stdio.h> 3f45c19578801a33c8518ffc95ecb17d92f38c9ebKostya Serebryany#include <string> 4f45c19578801a33c8518ffc95ecb17d92f38c9ebKostya Serebryany 5f45c19578801a33c8518ffc95ecb17d92f38c9ebKostya Serebryanyclass Action { 6f45c19578801a33c8518ffc95ecb17d92f38c9ebKostya Serebryany public: 7f45c19578801a33c8518ffc95ecb17d92f38c9ebKostya Serebryany Action() {} 8f45c19578801a33c8518ffc95ecb17d92f38c9ebKostya Serebryany void PrintString(const std::string& msg) const { 9f45c19578801a33c8518ffc95ecb17d92f38c9ebKostya Serebryany fprintf(stderr, "%s\n", msg.c_str()); 10f45c19578801a33c8518ffc95ecb17d92f38c9ebKostya Serebryany } 11f45c19578801a33c8518ffc95ecb17d92f38c9ebKostya Serebryany void Throw(const char& arg) const { 120b4c09b313580cfed9e1f3a2dc2f383dc870caa3Kostya Serebryany PrintString("PrintString called!"); // this line is important 13f45c19578801a33c8518ffc95ecb17d92f38c9ebKostya Serebryany throw arg; 14f45c19578801a33c8518ffc95ecb17d92f38c9ebKostya Serebryany } 15f45c19578801a33c8518ffc95ecb17d92f38c9ebKostya Serebryany}; 16f45c19578801a33c8518ffc95ecb17d92f38c9ebKostya Serebryany 17f45c19578801a33c8518ffc95ecb17d92f38c9ebKostya Serebryanyint main() { 18f45c19578801a33c8518ffc95ecb17d92f38c9ebKostya Serebryany const Action a; 19f45c19578801a33c8518ffc95ecb17d92f38c9ebKostya Serebryany fprintf(stderr, "&a before = %p\n", &a); 20f45c19578801a33c8518ffc95ecb17d92f38c9ebKostya Serebryany try { 21f45c19578801a33c8518ffc95ecb17d92f38c9ebKostya Serebryany a.Throw('c'); 220b4c09b313580cfed9e1f3a2dc2f383dc870caa3Kostya Serebryany } catch(const char&) { 23f45c19578801a33c8518ffc95ecb17d92f38c9ebKostya Serebryany fprintf(stderr, "&a in catch = %p\n", &a); 24f45c19578801a33c8518ffc95ecb17d92f38c9ebKostya Serebryany } 25f45c19578801a33c8518ffc95ecb17d92f38c9ebKostya Serebryany fprintf(stderr, "&a final = %p\n", &a); 26f45c19578801a33c8518ffc95ecb17d92f38c9ebKostya Serebryany return 0; 27f45c19578801a33c8518ffc95ecb17d92f38c9ebKostya Serebryany} 28