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