brintos

brintos / llvm-project-archived public Read only

0
0
Text · 583 B · ecd406d Raw
28 lines · cpp
1// See http://llvm.org/bugs/show_bug.cgi?id=114682#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 important13    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