[llvm-commits] [compiler-rt] r145839 - /compiler-rt/trunk/lib/asan/tests/asan_exceptions_test.cc
Kostya Serebryany
kcc at google.com
Mon Dec 5 11:20:57 PST 2011
Author: kcc
Date: Mon Dec 5 13:20:57 2011
New Revision: 145839
URL: http://llvm.org/viewvc/llvm-project?rev=145839&view=rev
Log:
[asan] add the test for bug 11468
Added:
compiler-rt/trunk/lib/asan/tests/asan_exceptions_test.cc
Added: compiler-rt/trunk/lib/asan/tests/asan_exceptions_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/asan_exceptions_test.cc?rev=145839&view=auto
==============================================================================
--- compiler-rt/trunk/lib/asan/tests/asan_exceptions_test.cc (added)
+++ compiler-rt/trunk/lib/asan/tests/asan_exceptions_test.cc Mon Dec 5 13:20:57 2011
@@ -0,0 +1,27 @@
+// See http://llvm.org/bugs/show_bug.cgi?id=11468
+#include <stdio.h>
+#include <string>
+
+class Action {
+ public:
+ Action() {}
+ void PrintString(const std::string& msg) const {
+ fprintf(stderr, "%s\n", msg.c_str());
+ }
+ void Throw(const char& arg) const {
+ PrintString("PrintString called!"); // this line is important
+ throw arg;
+ }
+};
+
+int main() {
+ const Action a;
+ fprintf(stderr, "&a before = %p\n", &a);
+ try {
+ a.Throw('c');
+ } catch (const char&) {
+ fprintf(stderr, "&a in catch = %p\n", &a);
+ }
+ fprintf(stderr, "&a final = %p\n", &a);
+ return 0;
+}
More information about the llvm-commits
mailing list