1 | // See http://llvm.org/bugs/show_bug.cgi?id=11468 |
2 | #include <stdio.h> |
3 | #include <string> |
4 | |
5 | class 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 | |
17 | int main() { |
18 | const Action a; |
19 | fprintf(stderr, format: "&a before = %p\n" , &a); |
20 | try { |
21 | a.Throw(arg: 'c'); |
22 | } catch(const char&) { |
23 | fprintf(stderr, format: "&a in catch = %p\n" , &a); |
24 | } |
25 | fprintf(stderr, format: "&a final = %p\n" , &a); |
26 | return 0; |
27 | } |
28 | |