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