aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-10-29 08:14:02 +0000
committerJohn McCall <rjmccall@apple.com>2010-10-29 08:14:02 +0000
commit14e1bc9201681a52e06b0544ee800b422f6f3efe (patch)
treedeb1010118b3530b961a305e1608596eb2830dcc
parent87a4ed905e2febe64021dcdfcdc7f00b27e92f32 (diff)
Don't assert on attempts to throw 'bool'. I wonder if in the history of C++
anyone has ever intentionally done this outside of a compiler test case. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117645 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/CGException.cpp2
-rw-r--r--test/CodeGenCXX/throw-expressions.cpp5
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/CodeGen/CGException.cpp b/lib/CodeGen/CGException.cpp
index 79646f3316..cb7bad2575 100644
--- a/lib/CodeGen/CGException.cpp
+++ b/lib/CodeGen/CGException.cpp
@@ -526,7 +526,7 @@ static void EmitAnyExprToExn(CodeGenFunction &CGF, const Expr *E,
// __cxa_allocate_exception returns a void*; we need to cast this
// to the appropriate type for the object.
- const llvm::Type *Ty = CGF.ConvertType(E->getType())->getPointerTo();
+ const llvm::Type *Ty = CGF.ConvertTypeForMem(E->getType())->getPointerTo();
llvm::Value *TypedExnLoc = CGF.Builder.CreateBitCast(ExnLoc, Ty);
// FIXME: this isn't quite right! If there's a final unelided call
diff --git a/test/CodeGenCXX/throw-expressions.cpp b/test/CodeGenCXX/throw-expressions.cpp
index 1670e44502..f41d35ec37 100644
--- a/test/CodeGenCXX/throw-expressions.cpp
+++ b/test/CodeGenCXX/throw-expressions.cpp
@@ -8,3 +8,8 @@ int& test1() {
int test2() {
return val ? throw val : val;
}
+
+// rdar://problem/8608801
+void test3() {
+ throw false;
+}